public Response<RespTutorAccountDetails> GetTutorBankDetails(ReqTutorAccountDetails objReq) { Response<RespTutorAccountDetails> response = new Response<RespTutorAccountDetails>(); List<RespTutorAccountDetails> objResp = new List<RespTutorAccountDetails>(); try { objDbMethodV2 = new wizz.Dal.DbMethodsV2(); RespTutorAccountDetails tryObj = new RespTutorAccountDetails(); tryObj = objDbMethodV2.GetTutorBankDetail(objReq); if (tryObj.accountNumber == null) { } else { objResp.Add(tryObj); } if (objResp.Count > 0) { response.Create(true, "done", Messages.AppVersion, objResp); } else { // objResp = new List<RespTutorAccountDetails>(); response.Create(false, "No data found", Messages.AppVersion, objResp); } } catch (Exception ex) { object session = new JavaScriptSerializer().Serialize(objReq); LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message); response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp); } finally { } return response; return response; }
internal RespTutorAccountDetails GetTutorBankDetail(ReqTutorAccountDetails objReq) { RespTutorAccountDetails objResp = new RespTutorAccountDetails(); if (string.IsNullOrEmpty(objReq.userId)) { objReq.userId = "0"; } using (var db = new WizzDataContext()) { objResp = (from d in db.tblTutorBankDetails where d.fkUserId == Convert.ToInt64(objReq.userId) select new RespTutorAccountDetails { micrCode = d.micrCode == null ? "" : d.micrCode, accountHolderName = d.accountHolderName.ToString(), accountId = d.accountNumber.ToString(), accountNumber = d.accountNumber.ToString(), branchAddress = d.branchAddress.ToString(), bankName = d.bankName.ToString(), ifscCode = d.ifscCode.ToString() }).FirstOrDefault(); if (objResp == null) { objResp = new RespTutorAccountDetails(); } return objResp; } }
public Response<string> SaveTutorBankDetails(RespTutorAccountDetails objReq) { Response<string> response = new Response<string>(); List<string> objResp = new List<string>(); try { objDbMethodV2 = new wizz.Dal.DbMethodsV2(); if (objDbMethodV2.PostBankAccountDetails(objReq)) response.Create(true, "done", Messages.AppVersion, objResp); else { response.Create(false, "you are not allowed", Messages.AppVersion, objResp); } } catch (Exception ex) { object session = new JavaScriptSerializer().Serialize(objReq); LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message); response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp); } finally { } return response; }
internal bool PostBankAccountDetails(RespTutorAccountDetails objReq) { try { using (var db = new WizzDataContext()) { tblTutorBankDetail obj; obj = db.tblTutorBankDetails.Where(c => c.fkUserId == Convert.ToInt64(objReq.userId)).FirstOrDefault(); if (obj == null) { obj = new tblTutorBankDetail(); obj.fkUserId = Convert.ToInt32(objReq.userId); obj.pkId = Convert.ToInt32(objReq.accountId); obj.bankName = objReq.bankName; obj.accountHolderName = objReq.accountHolderName; obj.accountNumber = objReq.accountNumber; obj.ifscCode = objReq.ifscCode; obj.micrCode = objReq.micrCode; obj.branchAddress = objReq.branchAddress; obj.createdDate = DateTime.UtcNow; db.tblTutorBankDetails.InsertOnSubmit(obj); db.SubmitChanges(); return true; } else { obj.fkUserId = Convert.ToInt32(objReq.userId); //obj.pkId = Convert.ToInt32(model.accountId); obj.bankName = objReq.bankName; obj.accountHolderName = objReq.accountHolderName; obj.accountNumber = objReq.accountNumber; obj.ifscCode = objReq.ifscCode; obj.micrCode = objReq.micrCode; obj.branchAddress = objReq.branchAddress; obj.createdDate = DateTime.UtcNow; db.SubmitChanges(); return true; } } } catch (Exception ex) { return false; } }