private void LoadState() { DataTable dt = new DataTable(); try { try { CompanyMaster_BL = new CompanyMaster_BL(); dt = CommonClasses.Execute("select SM_CODE,SM_NAME from STATE_MASTER where ES_DELETE=0 and SM_CM_COMP_ID=" + Session["CompanyId"] + " and SM_COUNTRY_CODE=" + ddlCountry.SelectedValue + ""); ddlState.DataSource = dt; ddlState.DataTextField = "SM_NAME"; ddlState.DataValueField = "SM_CODE"; ddlState.DataBind(); ddlState.Items.Insert(0, new ListItem("------State-------", "0")); ddlState.SelectedIndex = -1; } catch (Exception ex) { CommonClasses.SendError("Company Master", "LoadState", ex.Message); } finally { dt.Dispose(); } } catch (Exception ex) { CommonClasses.SendError("Company Master", "LoadState", ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { try { if (string.IsNullOrEmpty((string)Session["CompanyId"]) && string.IsNullOrEmpty((string)Session["Username"])) { Response.Redirect("~/Default.aspx", false); } else { if (!IsPostBack) { try { DataTable dtRights = CommonClasses.Execute("select UR_RIGHTS from USER_RIGHT where UR_IS_DELETE=0 AND UR_UM_CODE='" + Convert.ToInt32(Session["UserCode"]) + "' and UR_SM_CODE='1'"); right = dtRights.Rows.Count == 0 ? "0000000" : dtRights.Rows[0][0].ToString(); if (CommonClasses.ValidRights(int.Parse(right.Substring(0, 1)), this, "For Menu")) { LoadCountry(); CompanyMaster_BL = new CompanyMaster_BL(); mlCode = Convert.ToInt32(Session["CompanyId"]); ViewRec("MOD"); } else { Response.Write("<script> alert('You Have No Rights To View.');window.location='../Default.aspx'; </script>"); } } catch (Exception ex) { CommonClasses.SendError("Company Master", "PageLoad", ex.Message); } } } } catch (Exception ex) { CommonClasses.SendError("Company Master", "PageLoad", ex.Message); } }
private void LoadCountry() { DataTable dt = new DataTable(); try { CompanyMaster_BL = new CompanyMaster_BL(); dt = CommonClasses.Execute("select COUNTRY_CODE,COUNTRY_NAME from COUNTRY_MASTER where ES_DELETE=0 and COUNTRY_CM_COMP_ID=" + Session["CompanyId"] + ""); ddlCountry.DataSource = dt; ddlCountry.DataTextField = "COUNTRY_NAME"; ddlCountry.DataValueField = "COUNTRY_CODE"; ddlCountry.DataBind(); ddlCountry.Items.Insert(0, new ListItem("------Country-------", "0")); } catch (Exception ex) { CommonClasses.SendError("Company Master", "LoadCountry", ex.Message); } finally { dt.Dispose(); } }
private void ViewRec(string str) { try { CompanyMaster_BL = new CompanyMaster_BL(mlCode); DataTable dt = new DataTable(); CompanyMaster_BL.GetInfo(); GetValues(str); if (str == "MOD") { CommonClasses.SetModifyLock("CITY_MASTER", "MODIFY", "CITY_CODE", mlCode); } } catch (Exception Ex) { CommonClasses.SendError("Company Master", "ViewRec", Ex.Message); } //try //{ // CompanyMaster_BL = new CompanyMaster_BL(mlCode); // DataTable dt = new DataTable(); // CompanyMaster_BL.GetInfo(); // //DataTable DtCompInfo = CommonClasses.Execute("SELECT CM_CODE,CM_ID, CM_NAME,CM_ADDRESS1, CM_ADDRESS2, CM_ADDRESS3, CM_CITY, CM_STATE, CM_COUNTRY, CM_OWNER, CM_PHONENO1, CM_PHONENO2, CM_PHONENO3, CM_FAXNO, CM_EMAILID, CM_WEBSITE, CM_SURCHARGE_NO, CM_VAT_TIN_NO, CM_CST_NO, CM_SERVICE_TAX_NO, CM_PAN_NO, CM_COMMODITY_NO, CM_ACTIVE_IND, CM_OPENING_DATE, CM_CLOSING_DATE FROM COMPANY_MASTER WHERE CM_DELETE_FLAG='false' and CM_ID = " + mlCode + ""); // if (DtCompInfo.Rows.Count > 0) // { // mlCode = Convert.ToInt32(DtCompInfo.Rows[0]["CM_CODE"]); ; // txtCompanyName.Text = DtCompInfo.Rows[0]["CM_NAME"].ToString(); // txtAddressLine1.Text = DtCompInfo.Rows[0]["CM_ADDRESS1"].ToString(); // txtAddressLine2.Text = DtCompInfo.Rows[0]["CM_ADDRESS2"].ToString(); // //CompanyMaster_BL.CM_ADDRESS3; // txtAuthSign.Text = DtCompInfo.Rows[0]["CM_OWNER"].ToString(); // txtPhoneNo1.Text = DtCompInfo.Rows[0]["CM_PHONENO1"].ToString(); // txtPhoneNumber2.Text = DtCompInfo.Rows[0]["CM_PHONENO2"].ToString(); // txtPhoneNumber3.Text = DtCompInfo.Rows[0]["CM_PHONENO3"].ToString(); // txtFaxNo.Text = DtCompInfo.Rows[0]["CM_FAXNO"].ToString(); // txtEmailId.Text = DtCompInfo.Rows[0]["CM_EMAILID"].ToString(); // txtWebsite.Text = DtCompInfo.Rows[0]["CM_WEBSITE"].ToString(); // // CompanyMaster_BL.CM_SURCHARGE_NO; // txtVatTinNo.Text = DtCompInfo.Rows[0]["CM_VAT_TIN_NO"].ToString(); // txtCstNo.Text = DtCompInfo.Rows[0]["CM_CST_NO"].ToString(); // txtServiceTax.Text = DtCompInfo.Rows[0]["CM_SERVICE_TAX_NO"].ToString(); // txtPanNo.Text = DtCompInfo.Rows[0]["CM_PAN_NO"].ToString(); // // CompanyMaster_BL.CM_COMMODITY_NO; // if (DtCompInfo.Rows[0]["CM_ACTIVE_IND"].ToString() == "True") // { // cbActiveIndex.Checked = true; // } // else // { // cbActiveIndex.Checked = false; // } // txtOpeningDate.Text = Convert.ToDateTime(DtCompInfo.Rows[0]["CM_OPENING_DATE"]).ToString("dd/MMM/yyyy"); // txtClosingDate.Text = Convert.ToDateTime(DtCompInfo.Rows[0]["CM_CLOSING_DATE"]).ToString("dd/MMM/yyyy"); // int Country = Convert.ToInt32(DtCompInfo.Rows[0]["CM_COUNTRY"]); // int state =Convert.ToInt32( DtCompInfo.Rows[0]["CM_STATE"]); // int City = Convert.ToInt32(DtCompInfo.Rows[0]["CM_CITY"]); // LoadCountry(); // ddlCountry.SelectedValue = Country.ToString(); // LoadState(); // ddlState.SelectedValue = state.ToString(); // LoadCity(); // ddlCity.SelectedValue = City.ToString(); // if (str == "VIEW") // { // txtCompanyName.Enabled = false; // txtAddressLine1.Enabled = false; // txtAddressLine2.Enabled = false; // //CompanyMaster_BL.CM_ADDRESS3; // //ddlCity.Text.Enabled = false; // //ddlState.Text.Enabled = false; // ddlCountry.Enabled = false; // txtAuthSign.Enabled = false; // txtPhoneNo1.Enabled = false; // txtPhoneNumber2.Enabled = false; // txtPhoneNumber3.Enabled = false; // txtFaxNo.Enabled = false; // txtEmailId.Enabled = false; // txtWebsite.Enabled = false; // txtVatTinNo.Enabled = false; // txtCstNo.Enabled = false; // txtServiceTax.Enabled = false; // txtPanNo.Enabled = false; // cbActiveIndex.Enabled = false; // txtOpeningDate.Enabled = false; // txtClosingDate.Enabled = false; // btnSubmit.Visible = false; // } // } //} //catch (Exception ex) //{ // CommonClasses.SendError("Company Master", "ViewRec", ex.Message); //} }
bool SaveRec() { bool result = false; try { //if (cbActiveIndex.Checked == false) //{ // ShowMessage("#Avisos", "Please Check Active Checkbox", CommonClasses.MSG_Warning); // return false; //} //else //{ // DataTable dtComp = CommonClasses.Execute("Update COMPANY_MASTER Set CM_NAME = '" + txtCompanyName.Text + "',CM_ADDRESS1 = '" + txtAddressLine1.Text + "', CM_ADDRESS2 = '" + txtAddressLine2.Text + "', CM_ADDRESS3 = '', CM_CITY = '" + Convert.ToInt32(ddlCity.SelectedValue) + "', CM_STATE = '" + Convert.ToInt32(ddlState.SelectedValue) + "', CM_COUNTRY = '" + Convert.ToInt32(ddlCountry.SelectedValue) + "', CM_OWNER = '"+txtAuthSign.Text+"', CM_PHONENO1 = '" + txtPhoneNo1.Text + "', CM_PHONENO2 = '" + txtPhoneNumber2.Text + "',CM_PHONENO3 = '" + txtPhoneNumber3.Text + "', CM_FAXNO = '" + txtFaxNo.Text + "', CM_EMAILID = '" + txtEmailId.Text + "', CM_WEBSITE = '" + txtWebsite.Text + "', CM_SURCHARGE_NO = '', CM_VAT_TIN_NO = '" + txtVatTinNo.Text + "', CM_CST_NO = '" + txtCstNo.Text + "', CM_SERVICE_TAX_NO = '" + txtServiceTax.Text + "', CM_PAN_NO = '" + txtPanNo.Text + "',CM_COMMODITY_NO = '', CM_ACTIVE_IND = '" + cbActiveIndex.Checked + "', CM_OPENING_DATE = '" + Convert.ToDateTime(txtOpeningDate.Text).ToString("yyyy/MM/dd") + "', CM_CLOSING_DATE = '" + Convert.ToDateTime(txtClosingDate.Text).ToString("yyyy/MM/dd") + "' Where CM_ID = " + Convert.ToInt32(Session["CompanyId"]) + ""); // if(dtComp.Rows.Count==0) // { // CommonClasses.RemoveModifyLock("COMPANY_MASTER", "CM_MODIFY_FLAG", "CM_ID", mlCode); // CommonClasses.WriteLog("Company Information", "Update", "Company Information", txtCompanyName.Text, mlCode, Convert.ToInt32(Session["CompanyId"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); // result = true; // // ShowMessage("#Avisos", "Record Updated Successfully", CommonClasses.MSG_Ok); // Response.Redirect("~/Admin/Default.aspx", false); // } // else // { // ShowMessage("#Avisos", "Record Already Exists", CommonClasses.MSG_Warning); // } //} //lblmsg.Visible = false; CompanyMaster_BL = new CompanyMaster_BL(mlCode); if (Setvalues()) { if (cbActiveIndex.Checked == false) { //PanelMsg.Visible = true; //lblmsg.Text = "Please Check Active Checkbox"; ShowMessage("#Avisos", "Please Check Active Checkbox", CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); return(false); } if (CompanyMaster_BL.Update()) { CommonClasses.RemoveModifyLock("COMPANY_MASTER", "CM_MODIFY_FLAG", "CM_ID", mlCode); CommonClasses.WriteLog("Company Information", "Update", "Company Information", CompanyMaster_BL.CM_NAME, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; //ShowMessage("#Avisos", CompanyMaster_BL.Msg.ToString(), CommonClasses.MSG_Ok); Response.Redirect("~/Admin/Default.aspx", false); } else { if (CompanyMaster_BL.Msg != "") { ShowMessage("#Avisos", CompanyMaster_BL.Msg, CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); //lblmsg.Visible = false; //lblmsg.Text = CompanyMaster_BL.Msg; CompanyMaster_BL.Msg = ""; } } } } catch (Exception ex) { CommonClasses.SendError("Company Master", "SaveRec", ex.Message); } return(result); }