private void ViewRec(string str) { try { BL_CityMaster = new CityMaster_BL(mlCode); DataTable dt = new DataTable(); BL_CityMaster.GetInfo(); GetValues(str); if (str == "MOD") { CommonClasses.SetModifyLock("CITY_MASTER", "MODIFY", "CITY_CODE", mlCode); } } catch (Exception Ex) { CommonClasses.SendError("City Master", "ViewRec", Ex.Message); } }
bool SaveRec() { bool result = false; try { string StrReplaceCityName = txtCityName.Text; StrReplaceCityName = StrReplaceCityName.Replace("'", "''"); if (Request.QueryString[0].Equals("INSERT")) { BL_CityMaster = new CityMaster_BL(); if (Setvalues()) { if (BL_CityMaster.Save()) { string Code = CommonClasses.GetMaxId("Select Max(CITY_CODE) from CITY_MASTER"); CommonClasses.WriteLog("City Master", "Save", "City Master", BL_CityMaster.CITY_NAME, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; Response.Redirect("~/Admin/View/ViewCityMaster.aspx", false); } else { if (BL_CityMaster.Msg != "") { PanelMsg.Visible = true; lblmsg.Text = BL_CityMaster.Msg.ToString(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); //ShowMessage("#Avisos", BL_CityMaster.Msg.ToString(), CommonClasses.MSG_Warning); BL_CityMaster.Msg = ""; } txtCityName.Focus(); } } } else if (Request.QueryString[0].Equals("MODIFY")) { BL_CityMaster = new CityMaster_BL(mlCode); if (Setvalues()) { if (BL_CityMaster.Update()) { CommonClasses.RemoveModifyLock("CITY_MASTER", "MODIFY", "CITY_CODE", mlCode); CommonClasses.WriteLog("City Master", "Update", "City Master", BL_CityMaster.CITY_NAME, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; Response.Redirect("~/Admin/View/ViewCityMaster.aspx", false); } else { if (BL_CityMaster.Msg != "") { PanelMsg.Visible = true; lblmsg.Text = BL_CityMaster.Msg.ToString(); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); //ShowMessage("#Avisos", BL_CityMaster.Msg.ToString(), CommonClasses.MSG_Warning); BL_CityMaster.Msg = ""; } txtCityName.Focus(); } } } } catch (Exception ex) { CommonClasses.SendError("City Master", "SaveRec", ex.Message); } return(result); }