Beispiel #1
0
def update_user_details(request,**field):
    is_updation=False
    if field["METHOD"]=="POST":
        is_updation=True

    api=gds_api.Gds_Api()
    response=api.RMS_UPDATE_USER_DETAILS(**field)    

    if is_updation==True:
        ##------Notify team through mail------------------------##        
        msg_body='<strong><span>Name='+response["Table"][0]["name"]+'</span></strong><br/>'
        msg_body+='<strong><span>ID='+str(response["Table"][0]["id"])+'</span></strong><br/><br/>'
        msg_body+='<table><thead><tr><th style="border:1px solid">FIELD</th><th style="border:1px solid">NEW VALUE</th></tr></thead>'
        msg_body+='<tbody>'
        key_list=edit_form.get_changed_list(field,response)
        for key in key_list:            
            msg_body+='<tr><td style="border:1px solid" style=>'+key+'</td><td style="border:1px solid">'+str(response["Table"][0][key])+'</td></tr>'        
        msg_body+='</tbody>'    
        msg_body+='</table><br/>'    
        msg_body+='<span>By= '+request.user.name+'</span><br/>'
        msg_body+='<span>Date= '+str(datetime.now().strftime(" %Y-%m-%d %H:%M %p"))+'</span><br/>'        
        msg_body='<div>'+msg_body+'</div>'
        flag_status=email_sender.sendmail(email_sender.USER_UPDATE_LIST,"Kunkka: User Modified - "+response["Table"][0]["name"],msg_body,response["Table"][0]["name"])
        ##-------------------------------------------------------##
    return response 
Beispiel #2
0
    def sendEmail(self, request, context):
        response = email_pb2.Reply()
        response.success = email_sender.sendmail(request.From, request.to,
                                                 request.subject, request.body)
        print(response)

        return response
Beispiel #3
0
def update_provider_status(request,**field):
    api=gds_api.Gds_Api()    
    field["TYPE"]="PROVIDER"
    field["USER"]=request.user.username
    provider_name=field["PROVIDER_NAME"]
    comment=field["COMMENT"]
    ##-------------Updating status in GDS DB----------------##
    temp_response = api.RMS_UPDATE_STATUS(**field)
    ##------------------------------------------------------##    
    
    ##----Clear cache of  allowed companies for each agent--##
    agents_field={"FLAG_ALL_INFO":0}
    all_agents=api.RMS_SUB_AGENT_STATUS(**agents_field)["Table"]
    chunk_ids=[]
    for agent in all_agents:
        chunk_ids.append(str(agent["id"]))                   
    flag_status=delete_allowed_compaies(chunk_ids)
    ##------------------------------------------------------##

    ##------Notify team through mail------------------------##
    ACTIVATION_STATUS=""
    if field["ACTIVE"]=="1":
        ACTIVATION_STATUS='<span style="color:darkGreen"><b>Activated</b></span><br/><br/>'
    elif field["ACTIVE"]=="0":
        ACTIVATION_STATUS='<span style="color:red"><b>Deactivated</b></span><br/><br/>'

    msg_body=ACTIVATION_STATUS
    msg_body+='<span>By: '+request.user.name+'</span><br/>'
    msg_body+='<span>Date: '+str(datetime.now().strftime(" %Y-%m-%d %H:%M %p"))+'</span><br/>'
    msg_body+='<span>comment: '+comment+'</span><br/>'
    msg_body='<div>'+msg_body+'</div>'
    flag_status=email_sender.sendmail(email_sender.PROVIDER_UPDATE_LIST,"RMS: "+provider_name+" Changed",msg_body,provider_name)
    ##-------------------------------------------------------##
    return temp_response