示例#1
0
 public int SaveOneTimeFee(OneTimeFee FeeModel)
 {
     try
     {
         var feexists = dbContext.OneTimeFees.Where(o => o.PhoneNumber == FeeModel.PhoneNumber).FirstOrDefault();
         if (feexists == null)
         {
             dbContext.OneTimeFees.Add(FeeModel);
             dbContext.SaveChanges();
             return(100);
         }
         else
         {
             feexists.Fee                    = FeeModel.Fee;
             feexists.Date                   = FeeModel.Date;
             feexists.Status                 = FeeModel.Status;
             feexists.FeeTransactionNo       = FeeModel.FeeTransactionNo;
             dbContext.Entry(feexists).State = System.Data.Entity.EntityState.Modified;
             dbContext.SaveChanges();
             return(100);
         }
     }
     catch (Exception ex)
     {
         ErrorLogDal objError = new ErrorLogDal();
         ErrorLog    model    = new ErrorLog();
         model.InnerException = ex.InnerException.InnerException.Message.ToString();
         model.Source         = "Update One Time Fee";
         int error = objError.InsertError(model);
         return(400);
     }
 }
示例#2
0
        public string GetDetails(string PhoneNumber)
        {
            try
            {
                OneTimeFee model      = new OneTimeFee();
                OneTimeFee FeeRecords = objProcessing.FetchFeeDetails(PhoneNumber);
                if (FeeRecords == null)
                {
                    return("300");
                }
                else
                {
                    model.FeeTransactionNo = FeeRecords.FeeTransactionNo;
                    model.Date             = FeeRecords.Date;
                    model.Status           = FeeRecords.Status;
                    model.OneTimeFeeID     = FeeRecords.OneTimeFeeID;
                    model.PhoneNumber      = FeeRecords.PhoneNumber;
                    model.Fee = FeeRecords.Fee;

                    string jsonResult = JsonConvert.SerializeObject(model, Formatting.Indented);
                    return(jsonResult);
                }
            }
            catch (Exception ex)
            {
                ErrorLogDal objError = new ErrorLogDal();
                ErrorLog    model    = new ErrorLog();
                model.InnerException = ex.InnerException.InnerException.Message.ToString();
                model.Source         = "OneTimeFee-Get";
                int error = objError.InsertError(model);
                return("400");
            }
        }