private List <string> ValidateWalletRequest(object obj) { List <string> strvalidationResult = new List <string>(); MDL.WalletRequest EntityValidation = new MDL.WalletRequest(); EntityValidation = (MDL.WalletRequest)obj; if (string.IsNullOrWhiteSpace(EntityValidation.wr_bankname)) { strvalidationResult.Add("Bank Name is required!"); } if (string.IsNullOrWhiteSpace(EntityValidation.wr_accountno)) { strvalidationResult.Add("Account No is required!"); } if (string.IsNullOrWhiteSpace(EntityValidation.wr_amount)) { strvalidationResult.Add("Amount is required!"); } if (string.IsNullOrWhiteSpace(EntityValidation.wr_refrenceid)) { strvalidationResult.Add("Refrence id is required!"); } return(strvalidationResult); }
public HttpResponseMessage doWalletRequest(MDL.WalletRequest model) { GlobalVarible.Clear(); List <string> strvalidationResult = new List <string>(); try { COM.DBHelper sqlhelper = new COM.DBHelper(); strvalidationResult = ValidateWalletRequest(model); if (strvalidationResult.Count() == 0) { model.userid = Guid.Parse(User.Identity.GetUserId()); string[,] param = { { "USERID", model.userid.ToString() }, { "AMOUNT", model.wr_amount }, { "TRANSMODE", model.wr_mode.ToString() }, { "ACCOUNTNO", model.wr_accountno }, { "BANKNAME", model.wr_bankname }, { "REFID", model.wr_refrenceid },{ "REMARKS", model.wr_remakrs }, { "USERLEVEL", ((int)User.GetUserlevel()).ToString() } }; COM.DBHelper.SQLReturnValue M = sqlhelper.ExecuteProcWithMessageKMT("WALLET_REQUEST", param, true); if (M.ValueFromSQL == 1) { GlobalVarible.AddMessage(M.MessageFromSQL); } else { throw new Exception(string.Join("<br />", M.MessageFromSQL)); } } else { throw new Exception(string.Join("<br />", strvalidationResult)); } return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } catch (Exception ex) { GlobalVarible.AddError(ex.Message); ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(model)); return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult })); } }