public object AddRemoveDormant(string status, [FromBody] DormantAcc dormantModel, string remarks = "") { try { MessageModel messageModel = new MessageModel() { Mphone = dormantModel.Mphone, MessageId = "999" }; string body; string demand = null; Reginfo reginfo; if (status == "D") { //dormantAccService.DeleteByCustomField(dormantModel.Mphone, "Mphone", new DormantAcc()); reginfo = _distributorService.SingleOrDefaultByCustomField(dormantModel.Mphone, "Mphone", new Reginfo()); //obj.Status = "A"; demand = "REVOKE_DORMANT"; reginfo.Remarks = remarks; body = "Dear User, Your account has successfully been revoked from dormant status."; } else { //dormantAccService.Add(dormantModel); reginfo = _distributorService.SingleOrDefaultByCustomField(dormantModel.Mphone, "Mphone", new Reginfo()); //obj.Status = "D"; demand = "INVOKE_DORMANT"; reginfo.Remarks = remarks; body = "Dear User, Your account has been put to dormant status."; } messageModel.MessageBody = body; //var ret = _distributorService.UpdateRegInfo(reginfo); _kycService.StatusChangeBasedOnDemand(dormantModel.Mphone, demand, dormantModel._ActionBy, remarks); var currentReginfo = AuditTrailForAddRemoveDormant(dormantModel, reginfo, status); MessageService messageService = new MessageService(); messageService.SendMessage(messageModel); return(HttpStatusCode.OK); } catch (Exception ex) { errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString()); return(HttpStatusCode.BadRequest); } }
private object AuditTrailForAddRemoveDormant(DormantAcc dormantModel, Reginfo prevReginfo, string status) { Reginfo currentReginfo = (Reginfo)_kycService.GetRegInfoByMphone(dormantModel.Mphone); var diffList = auditTrailService.GetAuditTrialFeildByDifferenceBetweenObject(currentReginfo, prevReginfo); AuditTrail auditTrail = new AuditTrail(); auditTrail.Who = dormantModel._ActionBy; auditTrail.WhatActionId = 4; auditTrail.WhichParentMenuId = 2; auditTrail.WhichMenu = "Client Profile"; auditTrail.WhichId = dormantModel.Mphone; if (status == "D") { auditTrail.Response = "Revoked from Dormant Successfully"; } else { auditTrail.Response = "Dormant Perform Successfully"; } auditTrail.InputFeildAndValue = diffList; auditTrailService.InsertIntoAuditTrail(auditTrail); return(currentReginfo); }