public ActionResult SaveFNMBranch(FNMBranch_VM brnch) { List <SessionListnew> list = Session["SesDet"] as List <SessionListnew>; if (list == null) { return(Redirect("Login/InLogin")); } else { brnch.CMPYCODE = list[0].CmpyCode; brnch.UserName = list[0].user_name; return(Json(_branchService.SaveFNMBranch(brnch), JsonRequestBehavior.AllowGet)); } }
public FNMBranch_VM EditFNMBranch(string CmpyCode, string BranchCode) { ds = _EzBusinessHelper.ExecuteDataSet("Select DIVISION,FNMBRANCH_CODE,CMPYCODE,DESCRIPTION,SNO,PRINTNAME,ADDRESS,EMAIL,WEBSITE,MOBILE,CURRENCY,COUNTRY,STATE from FNMBRANCH where CMPYCODE='" + CmpyCode + "' and FNMBRANCH_CODE='" + BranchCode + "' and Flag=0");// dt = ds.Tables[0]; DataRowCollection drc = dt.Rows; FNMBranch_VM ObjList = new FNMBranch_VM(); foreach (DataRow dr in drc) { ObjList.CMPYCODE = dr["CmpyCode"].ToString(); ObjList.FNMBRANCH_CODE = dr["FNMBRANCH_CODE"].ToString(); ObjList.DESCRIPTION = dr["DESCRIPTION"].ToString(); ObjList.PRINTNAME = dr["PRINTNAME"].ToString(); ObjList.ADDRESS = dr["ADDRESS"].ToString(); ObjList.EMAIL = dr["EMAIL"].ToString(); ObjList.WEBSITE = dr["WEBSITE"].ToString(); ObjList.MOBILE = dr["MOBILE"].ToString(); ObjList.CURRENCY = dr["CURRENCY"].ToString(); ObjList.COUNTRY = dr["COUNTRY"].ToString(); ObjList.STATE = dr["STATE"].ToString(); ObjList.DIVISION = dr["DIVISION"].ToString(); } return(ObjList); }
public FNMBranch_VM SaveFNMBranch(FNMBranch_VM FC) { return(_FNMBranchRepo.SaveFNMBranch(FC)); }
public FNMBranch_VM SaveFNMBranch(FNMBranch_VM branch) { try { if (!branch.EditFlag) { var Drecord = new List <string>(); int Stats1 = _EzBusinessHelper.ExecuteScalar("Select count(*) as [count1] from FNMBRANCH where CmpyCode='" + branch.CMPYCODE + "' and FNMBRANCH_CODE='" + branch.FNMBRANCH_CODE + "'"); if (Stats1 == 0) { StringBuilder sb = new StringBuilder(); sb.Append("'" + branch.FNMBRANCH_CODE + "',"); sb.Append("'" + branch.CMPYCODE + "',"); sb.Append("'" + branch.DESCRIPTION + "',"); sb.Append("'" + branch.SNO + "',"); sb.Append("'" + branch.PRINTNAME + "',"); sb.Append("'" + branch.ADDRESS + "',"); sb.Append("'" + branch.EMAIL + "',"); sb.Append("'" + branch.WEBSITE + "',"); sb.Append("'" + branch.MOBILE + "',"); sb.Append("'" + branch.CURRENCY + "',"); sb.Append("'" + branch.COUNTRY + "',"); sb.Append("'" + branch.DIVISION + "',"); sb.Append("'" + branch.STATE + "')"); _EzBusinessHelper.ExecuteNonQuery("insert into FNMBRANCH(FNMBRANCH_CODE,CMPYCODE,DESCRIPTION,SNO,PRINTNAME,ADDRESS,EMAIL,WEBSITE,MOBILE,CURRENCY,COUNTRY,DIVISION,STATE) values(" + sb.ToString() + ""); _EzBusinessHelper.ActivityLog(branch.CMPYCODE, branch.UserName, "Add FN Category", branch.FNMBRANCH_CODE, Environment.MachineName); branch.SaveFlag = true; branch.ErrorMessage = string.Empty; } else { Drecord.Add(branch.FNMBRANCH_CODE.ToString()); // branch.Drecord = Drecord; branch.SaveFlag = false; branch.ErrorMessage = "Duplicate Record"; } return(branch); } var StatsEdit = _EzBusinessHelper.ExecuteScalarDec("Select count(*) from FNMBRANCH where CmpyCode='" + branch.CMPYCODE + "' and FNMBRANCH_CODE='" + branch.FNMBRANCH_CODE + "'and Flag=0"); if (StatsEdit != 0) { StringBuilder sb = new StringBuilder(); sb.Append("CMPYCODE='" + branch.CMPYCODE + "',"); sb.Append("DESCRIPTION='" + branch.DESCRIPTION + "',"); sb.Append("SNO='" + branch.SNO + "',"); // sb.Append("'" + dtstr8 + "',"); sb.Append("PRINTNAME='" + branch.PRINTNAME + "',"); sb.Append("ADDRESS='" + branch.ADDRESS + "',"); sb.Append("EMAIL='" + branch.EMAIL + "',"); sb.Append("WEBSITE='" + branch.WEBSITE + "',"); sb.Append("MOBILE='" + branch.MOBILE + "',"); sb.Append("CURRENCY='" + branch.CURRENCY + "',"); sb.Append("COUNTRY='" + branch.COUNTRY + "',"); sb.Append("DIVISION='" + branch.DIVISION + "',"); sb.Append("STATE='" + branch.STATE + "'"); _EzBusinessHelper.ExecuteNonQuery("update FNMBRANCH set " + sb + " where CmpyCode='" + branch.CMPYCODE + "' and FNMBRANCH_CODE='" + branch.FNMBRANCH_CODE + "' and Flag=0"); _EzBusinessHelper.ActivityLog(branch.CMPYCODE, branch.UserName, "Update FNMBranch", branch.FNMBRANCH_CODE, Environment.MachineName); branch.SaveFlag = true; branch.ErrorMessage = string.Empty; } else { branch.SaveFlag = false; branch.ErrorMessage = "Record not available"; } } catch (Exception ex) { branch.SaveFlag = false; } return(branch); }