Example #1
0
 public object ChangeStatus(string remarks, Reginfo reginfo)
 {
     try
     {
         if (reginfo.Status == "C")
         {
             Reginfo prevRegInfo = (Reginfo)_repository.GetRegInfoByMphone(reginfo.Mphone);
             var     closeInfo   = (Tuple <string, string>)_repository.CloseAccount(reginfo.Mphone, reginfo.UpdateBy, remarks);
             if (closeInfo.Item1 == "1")
             {
                 var currentReginfo = (Reginfo)_repository.GetCloseRegInfoByMphone(reginfo.Mphone);
                 AuditTrailForStatusChange(prevRegInfo, currentReginfo, remarks);
                 return(closeInfo);
             }
             else
             {
                 return(closeInfo);
             }
         }
         else
         {
             string demand = null;
             if (reginfo.Status == "I")
             {
                 demand = "INWBLK";
             }
             else if (reginfo.Status == "A")
             {
                 demand = "ACC_ACTIVE";
             }
             else
             {
                 demand = "OUTWBLK";
             }
             Reginfo prevRegInfo = (Reginfo)_repository.GetRegInfoByMphone(reginfo.Mphone);
             _repository.StatusChangeBasedOnDemand(reginfo.Mphone, demand, reginfo.UpdateBy, remarks);
             var currentReginfo = (Reginfo)_repository.GetRegInfoByMphone(reginfo.Mphone);
             AuditTrailForStatusChange(prevRegInfo, currentReginfo, remarks);
             return(HttpStatusCode.OK);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }