Example #1
0
        public object Save([FromBody] CustomerRequest model)
        {
            try
            {
                if (model.ReqDate != null)
                {
                    switch (model.Status)
                    {
                    case "C":
                        customerReqLogService.updateRequestLog(model);
                        break;

                    case "P":
                        customerReqLogService.updateRequestLog(model);
                        break;

                    case "O":
                        customerReqLogService.updateRequestLog(model);
                        break;

                    case "Y":
                        customerReqLogService.deleteRequestLog(model);
                        model.CheckedBy = model.HandledBy;
                        customerRequestService.Add(model);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    CustomerReqLog reqModel = new CustomerReqLog()
                    {
                        ReqDate   = DateTime.Now,
                        CheckedBy = model.CheckedBy,
                        Mphone    = model.Mphone,
                        Remarks   = model.Remarks,
                        Status    = model.Status,
                        Request   = model.Request,
                        Gid       = Guid.NewGuid().ToString()
                    };
                    AuditTrail auditTrail = new AuditTrail();
                    auditTrail.Who                = model.CheckedBy;
                    auditTrail.WhatActionId       = 3;
                    auditTrail.WhichParentMenuId  = 2;
                    auditTrail.WhichMenu          = "Client Profile";
                    auditTrail.WhichId            = model.Mphone;
                    auditTrail.Response           = "Success! Request Generated Successfully";
                    auditTrail.InputFeildAndValue = auditTrailService.GetAuditTrialFeildBySingleObject(model);
                    auditTrailService.InsertIntoAuditTrail(auditTrail);
                    return(customerReqLogService.Add(reqModel));
                }
                return(model);
            }
            catch (Exception ex)
            {
                return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString()));
            }
        }
Example #2
0
 public object InsertModelToAuditTrail(object model, string who, int parentMenuId, int actionId, string menu, string whichId = null, string response = null)
 {
     try
     {
         AuditTrail auditTrail = new AuditTrail();
         auditTrail.Who = who;
         auditTrail.WhichParentMenuId  = parentMenuId;
         auditTrail.WhatActionId       = actionId;
         auditTrail.WhichMenu          = menu;
         auditTrail.WhichId            = whichId;
         auditTrail.Response           = response;
         auditTrail.InputFeildAndValue = auditTrailService.GetAuditTrialFeildBySingleObject(model);
         auditTrailService.InsertIntoAuditTrail(auditTrail);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }