protected void dgExciseTariffDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete")) { if (!ModifyLog(((Label)(dgExciseTariffDetails.Rows[e.RowIndex].FindControl("lblE_CODE"))).Text)) { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(); string E_CODE = ((Label)(dgExciseTariffDetails.Rows[e.RowIndex].FindControl("lblE_CODE"))).Text; string E_TARIFF_NO = ((Label)(dgExciseTariffDetails.Rows[e.RowIndex].FindControl("lblE_TARIFF_NO"))).Text; string E_COMMODITY = ((Label)(dgExciseTariffDetails.Rows[e.RowIndex].FindControl("lblE_COMMODITY"))).Text; string E_BASIC = ((Label)(dgExciseTariffDetails.Rows[e.RowIndex].FindControl("lblE_BASIC"))).Text; string E_SPECIAL = ((Label)(dgExciseTariffDetails.Rows[e.RowIndex].FindControl("lblE_SPECIAL"))).Text; string E_EDU_CESS = ((Label)(dgExciseTariffDetails.Rows[e.RowIndex].FindControl("lblE_EDU_CESS"))).Text; BL_ExciseTariffDetails.E_CODE = Convert.ToInt32(E_CODE); if (CommonClasses.CheckUsedInTran("SERVICE_TYPE_MASTER", "S_E_CODE", "AND ES_DELETE=0", E_CODE)) { PanelMsg.Visible = true; lblmsg.Text = "You cant delete this record it has used in Service Type Master"; ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); //ShowMessage("#Avisos", "You cant delete this record it has used in Item Master", CommonClasses.MSG_Warning); } else { bool flag = BL_ExciseTariffDetails.Delete(); if (flag == true) { CommonClasses.WriteLog("Excise Tariff Details", "Delete", "Excise Tariff Details", E_COMMODITY, Convert.ToInt32(E_CODE), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); //ShowMessage("#Avisos", CommonClasses.strRegDelSucesso, CommonClasses.MSG_Erro); PanelMsg.Visible = true; lblmsg.Text = "Record Deleted Successfully"; ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); } LoadExciseTariffDetails(); } } } else { //ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro); PanelMsg.Visible = true; lblmsg.Text = "You Have No Rights To Delete"; ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); return; } } catch (Exception Ex) { CommonClasses.SendError("ExciseTariffDetails", "dgExciseTariffDetails_RowDeleting", Ex.Message); } }
private void LoadExciseTariffDetails() { try { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(); BL_ExciseTariffDetails.E_CM_COMP_ID = Convert.ToInt32(Session["CompanyId"]); BL_ExciseTariffDetails.E_TALLY_GST_EXCISE = Convert.ToBoolean(Request.QueryString[0].ToString()); BL_ExciseTariffDetails.FillGrid(dgExciseTariffDetails); if (dgExciseTariffDetails.Rows.Count > 0) { dgExciseTariffDetails.Enabled = true; } } catch (Exception Ex) { CommonClasses.SendError("Excise Tariff Master", "LoadSector", Ex.Message); } }
private void ViewRec(string str) { try { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(mlCode); DataTable dt = new DataTable(); BL_ExciseTariffDetails.GetInfo(); GetValues(str); if (str == "MOD") { CommonClasses.SetModifyLock("EXCISE_TARIFF_MASTER", "MODIFY", "E_CODE", mlCode); } } catch (Exception Ex) { CommonClasses.SendError("EXCISE_TARIFF_MASTER", "ViewRec", Ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty((string)Session["CompanyId"]) && string.IsNullOrEmpty((string)Session["Username"])) { Response.Redirect("~/Default.aspx", false); } else { if (!IsPostBack) { 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='15'"); right = dtRights.Rows.Count == 0 ? "0000000" : dtRights.Rows[0][0].ToString(); try { LoadTallyAcc(); if (Request.QueryString[0].Equals("VIEW")) { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(); mlCode = Convert.ToInt32(Request.QueryString[1].ToString()); ViewRec("VIEW"); } else if (Request.QueryString[0].Equals("MODIFY")) { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(); mlCode = Convert.ToInt32(Request.QueryString[1].ToString()); ViewRec("MOD"); } txtTariffNo.Focus(); } catch (Exception ex) { CommonClasses.SendError("Excise Tariff Master", "PageLoad", ex.Message); } } } }
bool SaveRec() { bool result = false; try { string StrReplaceCommodity = txtCommodity.Text; StrReplaceCommodity = StrReplaceCommodity.Replace("'", "''"); if (Request.QueryString[0].Equals("INSERT")) { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(); if (Setvalues()) { if (BL_ExciseTariffDetails.Save()) { string Code = CommonClasses.GetMaxId("Select Max(E_CODE) from EXCISE_TARIFF_MASTER"); CommonClasses.WriteLog("Excise Tariff master", "Save", "Excise Tariff Master", BL_ExciseTariffDetails.E_COMMODITY, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; Response.Redirect("~/Masters/VIEW/ViewExciseTariffDetails.aspx?Title=false", false); } else { if (BL_ExciseTariffDetails.Msg != "") { ShowMessage("#Avisos", BL_ExciseTariffDetails.Msg.ToString(), CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); BL_ExciseTariffDetails.Msg = ""; } txtTariffNo.Focus(); } } } else if (Request.QueryString[0].Equals("MODIFY")) { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(mlCode); if (Setvalues()) { if (BL_ExciseTariffDetails.Update()) { CommonClasses.RemoveModifyLock(" EXCISE_TARIFF_MASTER", "MODIFY", "E_CODE", mlCode); CommonClasses.WriteLog("Excise Tariff Master", "Update", "Excise Tariff Master", BL_ExciseTariffDetails.E_COMMODITY, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; Response.Redirect("~/Masters/VIEW/ViewExciseTariffDetails.aspx?Title=false", false); } else { if (BL_ExciseTariffDetails.Msg != "") { ShowMessage("#Avisos", BL_ExciseTariffDetails.Msg.ToString(), CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); BL_ExciseTariffDetails.Msg = ""; } txtTariffNo.Focus(); } } } } catch (Exception ex) { CommonClasses.SendError("Excise Tariff Master", "SaveRec", ex.Message); } return(result); }
bool SaveRec() { bool result = false; try { string StrReplaceCommodity = txtCommodity.Text; StrReplaceCommodity = StrReplaceCommodity.Replace("'", "''"); if (Request.QueryString[0].Equals("INSERT")) { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(); if (Setvalues()) { //if (BL_ExciseTariffDetails.Save()) DataTable dtExist = CommonClasses.Execute(" SELECT * FROM EXCISE_TARIFF_MASTER where( E_TARIFF_NO='" + txtTariffNo.Text.Trim() + "' OR E_COMMODITY='" + txtCommodity.Text.Trim() + "') AND ES_DELETE=0 AND E_TALLY_GST_EXCISE=1 AND E_EX_TYPE = " + rbtType.SelectedIndex + "");; if (dtExist.Rows.Count > 0) { ShowMessage("#Avisos", "Record Already Exist", CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); txtTariffNo.Focus(); return(true); } if (CommonClasses.Execute1("INSERT INTO EXCISE_TARIFF_MASTER ( E_CM_COMP_ID, E_TARIFF_NO, E_COMMODITY, E_BASIC, E_SPECIAL, E_EDU_CESS, E_H_EDU, E_TALLY_BASIC, E_TALLY_SPECIAL, E_TALLY_EDU, E_TALLY_H_EDU, E_TALLY_GST_EXCISE,E_EX_TYPE)VALUES ('" + BL_ExciseTariffDetails.E_CM_COMP_ID + "', '" + BL_ExciseTariffDetails.E_TARIFF_NO + "','" + BL_ExciseTariffDetails.E_COMMODITY + "','" + BL_ExciseTariffDetails.E_BASIC + "','" + BL_ExciseTariffDetails.E_SPECIAL + "' ,'" + BL_ExciseTariffDetails.E_EDU_CESS + "','" + BL_ExciseTariffDetails.E_H_EDU + "' ,'" + BL_ExciseTariffDetails.E_TALLY_BASIC + "','" + BL_ExciseTariffDetails.E_TALLY_SPECIAL + "','" + BL_ExciseTariffDetails.E_TALLY_EDU + "','" + BL_ExciseTariffDetails.E_TALLY_H_EDU + "','" + BL_ExciseTariffDetails.E_TALLY_GST_EXCISE + "','" + rbtType.SelectedValue + "')")) { string Code = CommonClasses.GetMaxId("Select Max(E_CODE) from EXCISE_TARIFF_MASTER"); CommonClasses.WriteLog("Excise Tariff master", "Save", "Excise Tariff Master", BL_ExciseTariffDetails.E_COMMODITY, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; Response.Redirect("~/Masters/VIEW/ViewGST_HSNSAC_Master.aspx?Title=true", false); } else { if (BL_ExciseTariffDetails.Msg != "") { ShowMessage("#Avisos", BL_ExciseTariffDetails.Msg.ToString(), CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); BL_ExciseTariffDetails.Msg = ""; } txtTariffNo.Focus(); } } } else if (Request.QueryString[0].Equals("MODIFY")) { BL_ExciseTariffDetails = new ExciseTariffDetails_BL(mlCode); if (Setvalues()) { DataTable dtExist = CommonClasses.Execute(" SELECT * FROM EXCISE_TARIFF_MASTER where( E_TARIFF_NO='" + txtTariffNo.Text.Trim() + "' OR E_COMMODITY='" + txtCommodity.Text.Trim() + "') AND ES_DELETE=0 AND E_TALLY_GST_EXCISE=1 AND E_CODE!='" + mlCode + "'");; if (dtExist.Rows.Count > 0) { ShowMessage("#Avisos", "Record Already Exist", CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); txtTariffNo.Focus(); return(true); } if (CommonClasses.Execute1("UPDATE EXCISE_TARIFF_MASTER SET E_TARIFF_NO ='" + BL_ExciseTariffDetails.E_TARIFF_NO + "', E_COMMODITY ='" + BL_ExciseTariffDetails.E_COMMODITY + "', E_BASIC ='" + BL_ExciseTariffDetails.E_BASIC + "', E_SPECIAL ='" + BL_ExciseTariffDetails.E_SPECIAL + "', E_EDU_CESS ='" + BL_ExciseTariffDetails.E_EDU_CESS + "', E_H_EDU ='" + BL_ExciseTariffDetails.E_H_EDU + "', E_TALLY_BASIC ='" + BL_ExciseTariffDetails.E_TALLY_BASIC + "', E_TALLY_SPECIAL ='" + BL_ExciseTariffDetails.E_TALLY_SPECIAL + "', E_TALLY_EDU ='" + BL_ExciseTariffDetails.E_TALLY_EDU + "', E_TALLY_H_EDU = '" + BL_ExciseTariffDetails.E_TALLY_H_EDU + "',E_EX_TYPE='" + rbtType.SelectedValue + "' WHERE E_CODE='" + mlCode + "'")) { CommonClasses.RemoveModifyLock(" EXCISE_TARIFF_MASTER", "MODIFY", "E_CODE", mlCode); CommonClasses.WriteLog("Excise Tariff Master", "Update", "Excise Tariff Master", BL_ExciseTariffDetails.E_COMMODITY, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"])); result = true; Response.Redirect("~/Masters/VIEW/ViewGST_HSNSAC_Master.aspx?Title=true", false); } else { if (BL_ExciseTariffDetails.Msg != "") { ShowMessage("#Avisos", BL_ExciseTariffDetails.Msg.ToString(), CommonClasses.MSG_Warning); ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true); BL_ExciseTariffDetails.Msg = ""; } txtTariffNo.Focus(); } } } } catch (Exception ex) { CommonClasses.SendError("Excise Tariff Master", "SaveRec", ex.Message); } return(result); }