public bool Update()
    {
        bool result = false;

        try
        {
            //if (ChkExstUpdateName())
            //{
            if (CommonClasses.Execute("SELECT I_CAT_CODE,I_CAT_CM_COMP_ID,I_CAT_NAME FROM ITEM_CATEGORY_MASTER where I_CAT_NAME='" + I_CAT_NAME + "' and I_CAT_CODE!=" + I_CAT_CODE + "").Rows.Count == 0)
            {
                //SqlParameter[] Params =
                //{
                //    new SqlParameter("@I_CAT_CODE",I_CAT_CODE),
                //    new SqlParameter("@I_CAT_CM_COMP_ID",I_CAT_CM_COMP_ID),
                //    new SqlParameter("@I_CAT_NAME",I_CAT_NAME),
                //    new SqlParameter("@ES_DELETE",ES_DELETE),
                //    new SqlParameter("@MODIFY",MODIFY)
                //};
                //result = DL_DBAccess.Insertion_Updation_Delete("SP_ITEM_CATEGORY_MASTER_Update", Params);

                result = CommonClasses.Execute1("update ITEM_CATEGORY_MASTER set I_CAT_NAME='" + I_CAT_NAME + "' ,I_CAT_SHORTCLOSE='" + I_CAT_SHORTCLOSE + "'  where I_CAT_CODE='" + I_CAT_CODE + "'");
            }
            else
            {
                Msg = "Item Category Already Exist";
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Item Category Class", "Update", Ex.Message);
        }
        return(result);
    }
    protected void dgState_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (!ModifyLog(((Label)(dgState.Rows[e.RowIndex].FindControl("lblSM_CODE"))).Text))
            {
                string s_code = ((Label)(dgState.Rows[e.RowIndex].FindControl("lblSM_CODE"))).Text;
                string s_name = ((Label)(dgState.Rows[e.RowIndex].FindControl("lblSTATE_NAME"))).Text;

                //if (CommonClasses.CheckUsedInTran("ENQUERY_MASTER", "EQ_s_code", "AND ES_DELETE=0", s_code))
                //{
                //    ShowMessage("#Avisos", "You cant delete this record it has used in Components", CommonClasses.MSG_Warning);
                //}
                //else
                //{
                bool flag = CommonClasses.Execute1("UPDATE STATE_MASTER SET ES_DELETE = 1 WHERE SM_CODE='" + Convert.ToInt32(s_code) + "'");
                if (flag == true)
                {
                    CommonClasses.WriteLog("State Master", "Delete", "State Master", s_code, Convert.ToInt32(s_code), Convert.ToInt32(Session["CompanyId"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                    ShowMessage("#Avisos", CommonClasses.strRegDelSucesso, CommonClasses.MSG_Erro);
                }
                //}
                //}
                LoadState();
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("State Master", "dgState_RowDeleting", Ex.Message);
        }
    }
Beispiel #3
0
    public bool Update()
    {
        bool result = false;

        try
        {
            //if (ChkExstUpdateName())
            //{
            if (CommonClasses.Execute("SELECT A_CODE,A_NO,A_DESC FROM AREA_MASTER where A_DESC='" + A_DESC + "' and A_CODE!=" + A_CODE + "").Rows.Count == 0)
            {
                //SqlParameter[] Params =
                //{

                //  new SqlParameter("@A_CODE",A_CODE),
                //    new SqlParameter("@A_CM_COMP_ID",A_CM_COMP_ID),
                //    new SqlParameter("@A_NO",A_NO),
                //    new SqlParameter("@A_DESC",A_DESC)

                //};
                //result = DL_DBAccess.Insertion_Updation_Delete("SP_AREA_MASTER_Update", Params);

                result = CommonClasses.Execute1("UPDATE AREA_MASTER set A_NO='" + A_NO + "',A_DESC='" + A_DESC + "' where A_CODE=" + A_CODE + "");
            }
            else
            {
                Msg = "Area Code Already Exist";
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Area Class", "Update", Ex.Message);
        }
        return(result);
    }
Beispiel #4
0
    public bool Save()
    {
        bool result = false;

        DL_DBAccess = new DatabaseAccessLayer();
        try
        {
            if (CheckExistSaveName())
            {
                //    SqlParameter[] Params =
                //    {

                //        new SqlParameter("@A_CM_COMP_ID",A_CM_COMP_ID),
                //        new SqlParameter("@A_NO",A_NO),
                //        new SqlParameter("@A_DESC",A_DESC)


                //    };
                //    result = DL_DBAccess.Insertion_Updation_Delete("SP_ADMIN_MASTER_INSERT", Params);

                result = CommonClasses.Execute1("Insert into SUPPLIER_TYPE_MASTER(STM_CM_COMP_ID,STM_TYPE_CODE,STM_TYPE_DESC,STM_FIRST_LETTER)values(" + STM_CM_COMP_ID + ",'" + STM_TYPE_CODE + "','" + STM_TYPE_DESC + "','" + STM_FIRST_LETTER + "')");
            }


            else
            {
                Msg = "Supplier Type Code Already Exist";
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Supplier Class", "Save", Ex.Message);
        }
        return(result);
    }
    public bool Delete()
    {
        bool result = false;

        try
        {
            DataTable dtReqDet = CommonClasses.Execute("SELECT PRD_PRM_CODE,PRD_ORD_QTY,PRD_I_CODE,PRM_MR_CODE FROM PURCHASE_REQUISION_DETAIL,PRUCHASE_REQUISITION_MASTER WHERE PRD_PRM_CODE=PRM_CODE and PRD_PRM_CODE='" + PRM_CODE + "'");
            //Update Master Table Flag
            DL_DBAccess = new DatabaseAccessLayer();
            SqlParameter[] par = new SqlParameter[5];
            par[0] = new SqlParameter("@PK_CODE", PRM_CODE);
            par[1] = new SqlParameter("@PK_Field", "PRM_CODE");
            par[2] = new SqlParameter("@ES_DELETE", "1");
            par[3] = new SqlParameter("@DELETE", "ES_DELETE");
            par[4] = new SqlParameter("@TABLE_NAME", "PRUCHASE_REQUISITION_MASTER");
            result = DL_DBAccess.Insertion_Updation_Delete("SP_CM_DELETE", par);
            if (result == true)
            {
                for (int i = 0; i < dtReqDet.Rows.Count; i++)
                {
                    result = CommonClasses.Execute1("UPDATE MATERIAL_REQUISITION_DETAIL set MRD_PURC_REQ_QTY=MRD_PURC_REQ_QTY-" + dtReqDet.Rows[i]["PRD_ORD_QTY"] + " where MRD_MR_CODE='" + dtReqDet.Rows[i]["PRM_MR_CODE"] + "' and MRD_I_CODE='" + dtReqDet.Rows[i]["PRD_I_CODE"] + "'");
                }
            }
            return(result);
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Purchase Requisition", "Delete", Ex.Message);

            return(false);
        }
        finally
        { }
    }
Beispiel #6
0
    //#region GetRecords
    //public DataTable GetRecords(string Type)
    //{
    //    DataTable dt = new DataTable();
    //    DL_DBAccess = new DatabaseAccessLayer();

    //    try
    //    {
    //        SqlParameter[] Params =
    //        {
    //            new SqlParameter("@A_CODE",SqlDbType.Int),
    //            new SqlParameter("@A_U_CODE",SqlDbType.Int),
    //            new SqlParameter("@A_U_DATE",SqlDbType.Date),
    //            new SqlParameter("@A_CM_COMP_ID",SqlDbType.Int),
    //            new SqlParameter("@A_NO",SqlDbType.VarChar),
    //            new SqlParameter("@A_DESC",SqlDbType.VarChar),
    //            new SqlParameter("@ES_DELETE",SqlDbType.Bit),
    //            new SqlParameter("@MODIFY",SqlDbType.Bit),
    //            new SqlParameter("@TYPE",SqlDbType.VarChar)
    //        };

    //        if (A_CODE == 0)
    //        {
    //            Params[0].Value = DBNull.Value;
    //        }
    //        else
    //        {
    //            Params[0].Value = DBNull.Value;//A_CODE;

    //        }
    //        if (A_U_CODE == 0)
    //        {
    //            Params[1].Value = DBNull.Value;

    //        }
    //        else
    //        {

    //            Params[1].Value = A_U_CODE;

    //        }

    //        if (A_U_DATE != null)
    //        {
    //            Params[2].Value = DBNull.Value;

    //        }
    //        else
    //        {
    //            Params[2].Value = A_U_DATE;


    //        }

    //        if (A_CM_COMP_ID != 0)
    //        {
    //            Params[3].Value = A_CM_COMP_ID;
    //        }
    //        else
    //        {
    //            Params[3].Value = DBNull.Value;


    //        }

    //        if (A_NO != null)
    //        {
    //            Params[4].Value = A_NO;
    //        }
    //        else
    //        {
    //            Params[4].Value = DBNull.Value;

    //        }

    //        if (A_DESC != null)
    //        {
    //            Params[5].Value = A_DESC;
    //        }
    //        else
    //        {

    //            Params[5].Value = DBNull.Value;


    //        }


    //        if (ES_DELETE != null)
    //        {
    //            Params[6].Value = ES_DELETE;
    //        }
    //        else
    //        {
    //            Params[6].Value = DBNull.Value;
    //        }

    //        if (MODIFY != null)
    //        {
    //            Params[7].Value = MODIFY;
    //        }
    //        else
    //        {
    //            Params[7].Value = DBNull.Value;
    //        }
    //        if (Type != null)
    //        {
    //            Params[8].Value = Type;
    //        }
    //        else
    //        {
    //            Params[8].Value = DBNull.Value;
    //        }



    //        dt = DL_DBAccess.SelectData("SP_AREA_MASTER_Select", Params);

    //        return dt;
    //    }
    //    catch (Exception ex)
    //    {

    //        throw new Exception(ex.Message);
    //        CommonClasses.SendError("Currency Master", "GetRecords", ex.Message);
    //        return dt;
    //    }

    //}
    //#endregion


    #region Update
    public bool Update()
    {
        bool result = false;

        try
        {
            if (ChkExstUpdateName())
            {
                //SqlParameter[] Params =
                //{

                //  new SqlParameter("@A_CODE",A_CODE),
                //    new SqlParameter("@A_CM_COMP_ID",A_CM_COMP_ID),
                //    new SqlParameter("@A_NO",A_NO),
                //    new SqlParameter("@A_DESC",A_DESC)

                //};
                // result = DL_DBAccess.Insertion_Updation_Delete("SP_AREA_MASTER_Update", Params);

                result = CommonClasses.Execute1("Update  SUPPLIER_TYPE_MASTER set STM_CM_COMP_ID=" + STM_CM_COMP_ID + ",STM_TYPE_CODE='" + STM_TYPE_CODE + "',STM_TYPE_DESC='" + STM_TYPE_DESC + "',STM_FIRST_LETTER='" + STM_FIRST_LETTER + "' where STM_CODE=" + STM_CODE + " ");
            }

            else
            {
                Msg = "Supplier Type Code Already Exist";
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Supplier Class", "Update", Ex.Message);
        }
        return(result);
    }
Beispiel #7
0
    protected void dgBillofComponent_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
        {
            if (!ModifyLog(((Label)(dgBillofComponent.Rows[e.RowIndex].FindControl("lblBM_CODE"))).Text))
            {
                string bm_code = ((Label)(dgBillofComponent.Rows[e.RowIndex].FindControl("lblBM_CODE"))).Text;
                string i_name  = ((Label)(dgBillofComponent.Rows[e.RowIndex].FindControl("lblI_NAME"))).Text;
                string i_code  = ((Label)(dgBillofComponent.Rows[e.RowIndex].FindControl("lblI_CODENO"))).Text;

                if (CommonClasses.CheckUsedInTran("ENQUERY_MASTER", "EQ_P_CODE", "AND ES_DELETE=0", bm_code))
                {
                    ShowMessage("#Avisos", "You cant delete this record it has used in Components", CommonClasses.MSG_Warning);
                }
                else
                {
                    bool flag = CommonClasses.Execute1("UPDATE BOC_MASTER SET ES_DELETE = 1 WHERE BM_CODE='" + Convert.ToInt32(bm_code) + "'");
                    if (flag == true)
                    {
                        CommonClasses.WriteLog("Bill Of Component", "Delete", "Bill Of Component", bm_code, Convert.ToInt32(bm_code), Convert.ToInt32(Session["CompanyId"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        ShowMessage("#Avisos", CommonClasses.strRegDelSucesso, CommonClasses.MSG_Erro);
                    }
                }
            }

            LoadBOC();
        }
        else
        {
            ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);
            return;
        }
    }
Beispiel #8
0
    public bool Save()
    {
        bool result = false;

        DL_DBAccess = new DatabaseAccessLayer();
        try
        {
            if (CheckExistSaveName())
            {
                //SqlParameter[] Params =
                //{

                //    new SqlParameter("@A_CM_COMP_ID",A_CM_COMP_ID),
                //    new SqlParameter("@A_NO",A_NO),
                //    new SqlParameter("@A_DESC",A_DESC)


                //};
                //result = DL_DBAccess.Insertion_Updation_Delete("SP_ADMIN_MASTER_INSERT", Params);

                result = CommonClasses.Execute1("INSERT INTO AREA_MASTER (A_CM_COMP_ID,A_NO,A_DESC) values (" + A_CM_COMP_ID + ",'" + A_NO + "','" + A_DESC + "')");
            }
            else
            {
                Msg = "Area Code  Already Exist";
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Admin Class", "Save", Ex.Message);
        }
        return(result);
    }
    bool SaveRec()
    {
        bool result = false;

        try
        {
            if (Request.QueryString[0].Equals("INSERT"))
            {
                if (CommonClasses.Execute1("INSERT INTO BOM_MASTER(BM_CM_COMP_ID,BM_I_CODE)VALUES('" + Convert.ToInt32(Session["CompanyId"]) + "','" + ddlSItemCodeno.SelectedValue.ToString() + "')"))
                {
                    string Code = CommonClasses.GetMaxId("Select Max(BM_CODE) from BOM_MASTER");
                    for (int i = 0; i < dgvBOMaterialDetails.Rows.Count; i++)
                    {
                        CommonClasses.Execute1("INSERT INTO BOM_DETAIL(BD_BM_CODE,BD_I_CODE,BD_VQTY,BD_SCRAPQTY)VALUES('" + Code + "','" + ((Label)dgvBOMaterialDetails.Rows[i].FindControl("lblBD_I_CODE")).Text + "','" + ((Label)dgvBOMaterialDetails.Rows[i].FindControl("lblBD_VQTY")).Text + "','" + ((Label)dgvBOMaterialDetails.Rows[i].FindControl("lblBD_SCRAPQTY")).Text + "')");
                    }
                    CommonClasses.WriteLog("Bill Of Material", "Save", "Bill Of Material", ddlSItemCodeno.SelectedItem.Text, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                    result = true;
                    Response.Redirect("~/Masters/VIEW/ViewBOMMaster.aspx", false);
                }
                else
                {
                    ShowMessage("#Avisos", "Could not saved", CommonClasses.MSG_Warning);
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                    ddlSItemCodeno.Focus();
                }
            }
            else if (Request.QueryString[0].Equals("MODIFY"))
            {
                if (CommonClasses.Execute1("UPDATE BOM_MASTER SET BM_I_CODE='" + ddlSItemCodeno.SelectedValue.ToString() + "' WHERE BM_CODE='" + mlCode + "'"))
                {
                    result = CommonClasses.Execute1("DELETE FROM BOM_DETAIL WHERE BD_BM_CODE='" + mlCode + "'");
                    if (result)
                    {
                        for (int i = 0; i < dgvBOMaterialDetails.Rows.Count; i++)
                        {
                            CommonClasses.Execute1("INSERT INTO BOM_DETAIL(BD_BM_CODE,BD_I_CODE,BD_VQTY,BD_SCRAPQTY)VALUES('" + mlCode + "','" + ((Label)dgvBOMaterialDetails.Rows[i].FindControl("lblBD_I_CODE")).Text + "','" + ((Label)dgvBOMaterialDetails.Rows[i].FindControl("lblBD_VQTY")).Text + "','" + ((Label)dgvBOMaterialDetails.Rows[i].FindControl("lblBD_SCRAPQTY")).Text + "')");
                        }

                        CommonClasses.RemoveModifyLock("BOM_MASTER", "MODIFY", "BM_CODE", mlCode);
                        CommonClasses.WriteLog("Bill Of Material", "Update", "Bill Of Material", ddlSItemCodeno.SelectedValue.ToString(), mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect("~/Masters/VIEW/ViewBOMMaster.aspx", false);
                    }
                }
                else
                {
                    ShowMessage("#Avisos", "Invalid Update", CommonClasses.MSG_Warning);
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                    //txtCustomerID.Focus();
                }
            }
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Bill Of Material", "SaveRec", ex.Message);
        }
        return(result);
    }
    bool SaveRec()
    {
        bool result = false;

        try
        {
            if (Request.QueryString[0].Equals("INSERT"))
            {
                if (CommonClasses.Execute1("INSERT INTO BATCH_MASTER (BT_CM_CODE,BT_TYPE,BT_NO,BT_DATE,BT_WO_CODE,BT_WOD_I_CODE,BT_SHM_CODE,BT_FORMULA_TYPE,BT_CM_ID)VALUES('" + Convert.ToInt32(Session["CompanyCode"]) + "','" + ddlBatchType.SelectedValue + "','" + txtBatchNo.Text + "','" + Convert.ToDateTime(txtBatchDate.Text).ToString("dd/MMM/yyyy") + "','" + ddlWorkOrderNo.SelectedValue + "','" + ddlItemCode.SelectedValue + "','" + ddlFormulaCode.SelectedValue + "','" + ddlFormulaType.SelectedValue + "','" + Convert.ToInt32(Session["CompanyId"]) + "')"))
                {
                    string Code = CommonClasses.GetMaxId("Select Max(BT_CODE) from BATCH_MASTER");
                    for (int i = 0; i < dgMainShade.Rows.Count; i++)
                    {
                        CommonClasses.Execute1("INSERT INTO BATCH_DETAIL (BTD_BT_CODE,BTD_I_CODE,BTD_STEP_NO,BTD_PROCESS_CODE,BTD_QTY,BTD_WGT,BTD_QTY_IN) values ('" + Code + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblI_CODE")).Text + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblSTEP_NO")).Text + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblPROCESS_CODE")).Text + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblQTY_IN_LTR")).Text + "','" + (dgMainShade.Rows[i].Cells[7]).Text + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblQtyInKg")).Text + "')");
                    }
                    CommonClasses.WriteLog("Batch Ticket", "Save", "Batch Ticket", txtBatchNo.Text, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                    result = true;
                    dt2.Rows.Clear();
                    Response.Redirect("~/Transactions/VIEW/ViewBatchTicket.aspx", false);
                }
                else
                {
                    ShowMessage("#Avisos", "Record Not Saved", CommonClasses.MSG_Warning);
                    ddlBatchType.Focus();
                }
            }
            else if (Request.QueryString[0].Equals("MODIFY"))
            {
                if (CommonClasses.Execute1("UPDATE BATCH_MASTER SET BT_TYPE='" + ddlBatchType.SelectedValue + "',BT_NO='" + txtBatchNo.Text + "',BT_DATE='" + Convert.ToDateTime(txtBatchDate.Text).ToString("dd/MMM/yyyy") + "',BT_WO_CODE='" + ddlWorkOrderNo.SelectedValue + "',BT_WOD_I_CODE='" + ddlItemCode.SelectedValue + "',BT_SHM_CODE='" + ddlFormulaCode.SelectedValue + "',BT_FORMULA_TYPE='" + ddlFormulaType.SelectedValue + "' where BT_CODE='" + mlCode + "'"))
                {
                    result = CommonClasses.Execute1("DELETE FROM BATCH_DETAIL WHERE BTD_BT_CODE='" + mlCode + "'");
                    if (result)
                    {
                        for (int i = 0; i < dgMainShade.Rows.Count; i++)
                        {
                            CommonClasses.Execute1("INSERT INTO BATCH_DETAIL (BTD_BT_CODE,BTD_I_CODE,BTD_STEP_NO,BTD_PROCESS_CODE,BTD_QTY,BTD_WGT,BTD_QTY_IN) values ('" + mlCode + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblI_CODE")).Text + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblSTEP_NO")).Text + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblPROCESS_CODE")).Text + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblQTY_IN_LTR")).Text + "','" + (dgMainShade.Rows[i].Cells[7]).Text + "','" + ((Label)dgMainShade.Rows[i].FindControl("lblQtyInKg")).Text + "')");
                        }
                        CommonClasses.RemoveModifyLock("BATCH_MASTER", "MODIFY", "BT_CODE", mlCode);
                        CommonClasses.WriteLog("Batch Ticket", "Update", "Batch Ticket", txtBatchNo.Text, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        dt2.Rows.Clear();
                        result = true;
                    }
                    Response.Redirect("~/Transactions/VIEW/ViewBatchTicket.aspx", false);
                }
                else
                {
                    ShowMessage("#Avisos", "Record Not Saved", CommonClasses.MSG_Warning);
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    ddlBatchType.Focus();
                }
            }
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Batch Ticket", "SaveRec", ex.Message);
        }
        return(result);
    }
Beispiel #11
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgTally.Rows[e.RowIndex].FindControl("lblTALLY_CODE"))).Text))
                {
                    string um_code = ((Label)(dgTally.Rows[e.RowIndex].FindControl("lblTALLY_CODE"))).Text;
                    string um_name = ((Label)(dgTally.Rows[e.RowIndex].FindControl("lblTALLY_NAME"))).Text;


                    if (CommonClasses.CheckUsedInTran("EXCISE_TARIFF_MASTER", "((E_TALLY_BASIC=" + um_code + " or E_TALLY_SPECIAL=" + um_code + " or E_TALLY_EDU=" + um_code + " or E_TALLY_H_EDU=" + um_code + ") and 1", "AND ES_DELETE=0", "1)"))
                    {
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You cant delete this record it has used in GST 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 if (CommonClasses.CheckUsedInTran("SERVICE_TYPE_MASTER", "((S_ACCOUNT_SALES=" + um_code + " or S_ACCOUNT_PURCHASE=" + um_code + ") and 1", "AND ES_DELETE=0", "1)"))
                    {
                        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 = CommonClasses.Execute1("UPDATE TALLY_MASTER SET ES_DELETE = 1 WHERE TALLY_CODE='" + Convert.ToInt32(um_code) + "'");

                        if (flag == true)
                        {
                            CommonClasses.WriteLog("Tally Master", "Delete", "Tally Master", um_name, Convert.ToInt32(um_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);
                        }
                        LoadTally();
                    }
                }
            }
            else
            {
                ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);
                return;

                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
            }
        }
        catch (Exception exc)
        {
            CommonClasses.SendError("User Master", "GridView1_RowEditing", exc.Message);
        }
    }
Beispiel #12
0
    public bool Update()
    {
        bool result = false;

        try
        {
            if (ChkExstUpdateName())
            {
                #region old code
                //SqlParameter[] Params =
                //{
                //    new SqlParameter("@I_CODE",I_CODE),
                //    new SqlParameter("@I_CM_COMP_ID",I_CM_COMP_ID),
                //    new SqlParameter("@I_CAT_CODE",I_CAT_CODE),
                //    new SqlParameter("@I_CODENO",I_CODENO),
                //    new SqlParameter("@I_DRAW_NO",I_DRAW_NO),
                //    new SqlParameter("@I_NAME",I_NAME),
                //    new SqlParameter("@I_MATERIAL",I_MATERIAL),
                //    new SqlParameter("@I_SPECIFICATION",I_SPECIFICATION),
                //    new SqlParameter("@I_ET_CODE",I_ET_CODE),
                //    new SqlParameter("@I_T_ACCT_S",I_T_ACCT_S),
                //    new SqlParameter("@I_T_ACCT_P",I_T_ACCT_P),
                //    new SqlParameter("@I_UOM_CODE",I_UOM_CODE),
                //    new SqlParameter("@I_INV_CAT",I_INV_CAT),
                //    new SqlParameter("@I_MAX_LEVEL",I_MAX_LEVEL),
                //    new SqlParameter("@I_MIN_LEVEL",I_MIN_LEVEL),
                //    new SqlParameter("@I_REORDER_LEVEL",I_REORDER_LEVEL),
                //    new SqlParameter("@I_OP_BAL",I_OP_BAL),
                //    new SqlParameter("@I_OP_BAL_RATE",I_OP_BAL_RATE),
                //    new SqlParameter("@I_STORE_LOC",I_STORE_LOC),
                //    new SqlParameter("@I_INV_RATE",I_INV_RATE),
                //    new SqlParameter("@I_RECEIPT_DATE",I_RECEIPT_DATE),
                //    new SqlParameter("@I_ISSUE_DATE",I_ISSUE_DATE),
                //    new SqlParameter("@I_CURRENT_BAL",I_CURRENT_BAL),
                //    new SqlParameter("@I_ACTIVE_IND",I_ACTIVE_IND),
                //    new SqlParameter("@ES_DELETE",ES_DELETE),
                //    new SqlParameter("@MODIFY",MODIFY),
                //    new SqlParameter("@I_UWEIGHT",I_UWEIGHT),
                //    new SqlParameter("@I_UW_UOM_CODE",I_UW_UOM_CODE),
                //    new SqlParameter("@I_COST_HEAD",I_COST_HEAD)
                //};
                //result = DL_DBAccess.Insertion_Updation_Delete("SP_ITEM_MASTER_Update", Params);
                #endregion

                result = CommonClasses.Execute1("UPDATE ITEM_MASTER SET I_CAT_CODE='" + I_CAT_CODE + "',I_SCAT_CODE='" + I_SCAT_CODE + "',I_CODENO='" + I_CODENO + "',I_DRAW_NO='" + I_DRAW_NO + "',I_NAME='" + I_NAME + "',I_MATERIAL='" + I_MATERIAL + "',I_SPECIFICATION='" + I_SPECIFICATION + "',I_SIZE='" + I_SIZE + "',I_E_CODE='" + I_E_CODE + "',I_ACCOUNT_SALES='" + I_ACCOUNT_SALES + "',I_ACCOUNT_PURCHASE='" + I_ACCOUNT_PURCHASE + "',I_COSTING_HEAD='" + I_COSTING_HEAD + "',I_UOM_CODE='" + I_UOM_CODE + "',I_INV_CAT='" + I_INV_CAT + "',I_ACTIVE_IND='" + I_ACTIVE_IND + "',I_UWEIGHT='" + I_UWEIGHT + "',I_MAX_LEVEL='" + I_MAX_LEVEL + "',I_MIN_LEVEL='" + I_MIN_LEVEL + "', I_REORDER_LEVEL='" + I_REORDER_LEVEL + "',I_OP_BAL='" + I_OP_BAL + "',I_OPEN_RATE='" + I_OP_BAL_RATE + "',I_INV_RATE='" + I_INV_RATE + "',I_STORE_LOC='" + I_STORE_LOC + "',I_RECEIPT_DATE='" + I_RECEIPT_DATE.ToString("dd/MMM/yyyy") + "',I_ISSUE_DATE='" + I_ISSUE_DATE.ToString("dd/MMM/yyyy") + "',I_DENSITY='" + I_DENSITY + "',I_PIGMENT='" + I_PIGMENT + "',I_SOLIDS='" + I_SOLIDS + "',I_VOLATILE='" + I_VOLATILE + "',I_WEIGHT_UOM='" + I_WEIGHT_UOM + "' ,I_DEVELOMENT='" + I_DEVELOMENT + "' ,I_TARGET_WEIGHT='" + I_TARGET_WEIGHT + "' ,I_SUBCAT_CODE='" + I_SUBCAT_CODE + "'   WHERE I_CODE= '" + I_CODE + "'");
            }
            else
            {
                Msg = "Finished Product Already Exist";
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("inished Product Class", "Update", Ex.Message);
        }
        return(result);
    }
Beispiel #13
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     gd.Visible    = false;
     gdDiv.Visible = false;
     if (txtQuery.Text.Length > 0 && txtQuery.Text.Trim().Length > 0)
     {
         if (CommonClasses.Execute1(txtQuery.Text.Trim()))
         {
             if (txtQuery.Text.ToUpper().Trim().StartsWith("SELECT"))
             {
                 DataTable dt = new DataTable();
                 dt = CommonClasses.Execute(txtQuery.Text.Trim());
                 if (dt.Rows.Count > 0)
                 {
                     gd.DataSource = dt;
                     gd.DataBind();
                     gd.Visible    = true;
                     gdDiv.Visible = true;
                 }
                 else
                 {
                     lblmsg.Visible = true;
                     //lblmsg.Text = BL_State.Msg;
                     PanelMsg.Visible = true;
                     lblmsg.Text      = "No Record Found";
                     ScriptManager.RegisterStartupScript(this, Page.GetType(), "displayralert", "Showalert1();", true);
                 }
             }
             else
             {
                 lblmsg.Visible = true;
                 //lblmsg.Text = BL_State.Msg;
                 PanelMsg.Visible = true;
                 lblmsg.Text      = "Executed Successfully";
                 ScriptManager.RegisterStartupScript(this, Page.GetType(), "displayralert", "Showalert1();", true);
             }
         }
         else
         {
             lblmsg.Visible = true;
             //lblmsg.Text = BL_State.Msg;
             PanelMsg.Visible = true;
             lblmsg.Text      = "UnSuccessfully";
             ScriptManager.RegisterStartupScript(this, Page.GetType(), "displayralert", "Showalert1();", true);
         }
     }
     else
     {
         lblmsg.Visible = true;
         //lblmsg.Text = BL_State.Msg;
         PanelMsg.Visible = true;
         lblmsg.Text      = "Please Enter Query";
         ScriptManager.RegisterStartupScript(this, Page.GetType(), "displayralert", "Showalert1();", true);
     }
     txtQuery.Focus();
 }
    protected void dgItemSubCategory_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgItemSubCategory.Rows[e.RowIndex].FindControl("lblSCAT_CODE"))).Text))
                {
                    string s_code = ((Label)(dgItemSubCategory.Rows[e.RowIndex].FindControl("lblSCAT_CODE"))).Text;
                    string s_name = ((Label)(dgItemSubCategory.Rows[e.RowIndex].FindControl("lblSCAT_DESC"))).Text;

                    if (CommonClasses.CheckUsedInTran("ITEM_MASTER", "I_SCAT_CODE", "AND ES_DELETE=0", s_code))
                    {
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You can't delete this record becouse it has used in Item Master";

                        //ShowMessage("#Avisos", "You cant delete this record it has used in city master", CommonClasses.MSG_Warning);
                    }
                    else
                    {
                        bool flag = CommonClasses.Execute1("UPDATE ITEM_SUBCATEGORY_MASTER SET ES_DELETE = 1 WHERE SCAT_CODE='" + Convert.ToInt32(s_code) + "'");
                        if (flag == true)
                        {
                            CommonClasses.WriteLog("ITEM_SUBCATEGORY_MASTER", "Delete", "ITEM_SUBCATEGORY_MASTER", s_code, Convert.ToInt32(s_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";
                        }
                        LoadCategory();
                    }
                }
                else
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "Record Used By Another Person";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                    //ShowMessage("#Avisos", "Record Used By Another Person", CommonClasses.MSG_Erro);
                    return;
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You Have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                //    //ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);
                //   return;
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("ITEM_SUBCATEGORY_MASTER", "dgItemSubCategory_RowDeleting", Ex.Message);
        }
    }
Beispiel #15
0
    protected void btnChangePass_Click(object sender, EventArgs e)
    {
        try
        {
            if (dtUserDetail.Rows[0]["UM_LEVEL"].ToString() == "Administrator")
            {
                if (txtNewPassward.Text == txtConfirmPass.Text)
                {
                    string pass = CommonClasses.Encrypt(txtConfirmPass.Text);
                    bool   flag = CommonClasses.Execute1("UPDATE USER_MASTER SET UM_PASSWORD='******' WHERE UM_CODE='" + ddlUser.SelectedValue + "' ");
                    if (flag == true)
                    {
                        txtConfirmPass.Text = "";
                        txtNewPassward.Text = "";
                        txtusername.Text    = "";

                        lblmesg.Visible = true;
                        lblmesg.Text    = "Password Reset Successfull.";
                    }
                }
                else
                {
                    lblmesg.Visible = true;
                    lblmesg.Text    = "Password Mismatch. Please Enter Correct Password";
                    txtNewPassward.Focus();
                }
            }
            else
            {
                if (txtNewPassward.Text == txtConfirmPass.Text)
                {
                    string pass = CommonClasses.Encrypt(txtConfirmPass.Text);
                    bool   flag = CommonClasses.Execute1("UPDATE USER_MASTER SET UM_PASSWORD='******' WHERE UM_CODE='" + Session["UserCode"] + "'");
                    if (flag == true)
                    {
                        txtConfirmPass.Text = "";
                        txtNewPassward.Text = "";
                        txtusername.Text    = "";

                        lblmesg.Visible = true;
                        lblmesg.Text    = "Password Reset Successfull.";
                    }
                }
                else
                {
                    lblmesg.Visible = true;
                    lblmesg.Text    = "Password Mismatch. Please Enter Correct Password";
                    txtNewPassward.Focus();
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void dgInvoiceDettail_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
        {
            if (!ModifyLog(((Label)(dgInvoiceDettail.Rows[e.RowIndex].FindControl("lblINM_CODE"))).Text))
            {
                try
                {
                    string inv_code = ((Label)(dgInvoiceDettail.Rows[e.RowIndex].FindControl("lblINM_CODE"))).Text;
                    string inv_no   = ((Label)(dgInvoiceDettail.Rows[e.RowIndex].FindControl("lblINM_NO"))).Text;

                    bool flag = CommonClasses.Execute1("UPDATE INVOICE_MASTER SET ES_DELETE = 1 WHERE INM_CODE='" + Convert.ToInt32(inv_code) + "'");
                    if (flag == true)
                    {
                        CommonClasses.WriteLog("Tax Invoice", "Delete", "Tax Invoice", inv_no, Convert.ToInt32(inv_code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));

                        DataTable dt = CommonClasses.Execute("select isnull(INM_IS_SUPPLIMENT,0) as INM_IS_SUPPLIMENT from INVOICE_MASTER where INM_CODE='" + Convert.ToInt32(inv_code) + "'");
                        if (dt.Rows.Count > 0)
                        {
                            if (Convert.ToBoolean(dt.Rows[0]["INM_IS_SUPPLIMENT"]))
                            {
                            }
                            else
                            {
                                DataTable dtq = CommonClasses.Execute("SELECT IND_INQTY,IND_I_CODE,IND_CPOM_CODE FROM INVOICE_DETAIL where IND_INM_CODE=" + inv_code + " ");
                                for (int i = 0; i < dtq.Rows.Count; i++)
                                {
                                    CommonClasses.Execute("update CUSTPO_DETAIL set CPOD_DISPACH = CPOD_DISPACH - " + dtq.Rows[i]["IND_INQTY"] + " where CPOD_CPOM_CODE='" + dtq.Rows[i]["IND_CPOM_CODE"] + "' and CPOD_I_CODE='" + dtq.Rows[i]["IND_I_CODE"] + "'");
                                    CommonClasses.Execute("UPDATE ITEM_MASTER SET I_CURRENT_BAL=I_CURRENT_BAL+" + dtq.Rows[i]["IND_INQTY"] + " where I_CODE='" + dtq.Rows[i]["IND_I_CODE"] + "'");
                                }
                                flag = CommonClasses.Execute1("DELETE FROM STOCK_LEDGER WHERE STL_DOC_NO='" + inv_code + "' and STL_DOC_TYPE='TAXINV'");
                            }
                        }

                        PanelMsg.Visible = true;
                        lblmsg.Text      = "Record Deleted.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                    LoadInvoice();
                }
                catch (Exception Ex)
                {
                    CommonClasses.SendError("Tax Invoice View", "dgInvoiceDettail_RowDeleting", Ex.Message);
                }
            }
        }
        else
        {
            PanelMsg.Visible = true;
            lblmsg.Text      = "You Have No Rights To Delete";
            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

            return;
        }
    }
    protected void dgCity_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgCity.Rows[e.RowIndex].FindControl("lblCityCode"))).Text))
                {
                    string c_code = ((Label)(dgCity.Rows[e.RowIndex].FindControl("lblCityCode"))).Text;
                    string c_name = ((Label)(dgCity.Rows[e.RowIndex].FindControl("lblCityName"))).Text;

                    //if (CommonClasses.CheckUsedInTran("ENQUERY_MASTER", "EQ_c_code", "AND ES_DELETE=0", c_code))
                    //{
                    //    ShowMessage("#Avisos", "You cant delete this record it has used in Components", CommonClasses.MSG_Warning);
                    //}
                    //else
                    //{
                    bool flag = CommonClasses.Execute1("UPDATE CITY_MASTER SET ES_DELETE = 1 WHERE CITY_CODE='" + Convert.ToInt32(c_code) + "'");
                    if (flag == true)
                    {
                        CommonClasses.WriteLog("City Master", "Delete", "City Master", c_code, Convert.ToInt32(c_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);
                    }
                    //}
                    //}
                    LoadCity();
                }
                else
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "Record used by another user";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    //ShowMessage("#Avisos", "Record used by another user", CommonClasses.MSG_Warning);
                    return;
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You Have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                //ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);
                return;
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("City Master", "dgCity_RowDeleting", Ex.Message);
        }
    }
Beispiel #18
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgUser.Rows[e.RowIndex].FindControl("lblUM_CODE"))).Text))
                {
                    //BL_UserMaster = new UserMaster_BL();
                    string um_code = ((Label)(dgUser.Rows[e.RowIndex].FindControl("lblUM_CODE"))).Text;
                    string um_name = ((Label)(dgUser.Rows[e.RowIndex].FindControl("lblUserID"))).Text;

                    DataTable dtAdmin = CommonClasses.Execute("SELECT UM_IS_ADMIN FROM USER_MASTER WHERE ES_DELETE=0 AND UM_CM_ID=" + Session["CompanyId"] + " AND UM_CODE = " + um_code + " ");
                    if (Convert.ToBoolean(dtAdmin.Rows[0]["UM_IS_ADMIN"]) != true)
                    {
                        //BL_UserMaster.UM_CODE = Convert.ToInt32(um_code);
                        //  bool flag = BL_UserMaster.Delete();


                        bool flag = CommonClasses.Execute1("UPDATE USER_MASTER SET ES_DELETE = 1 WHERE UM_CODE='" + Convert.ToInt32(um_code) + "'");

                        if (flag == true)
                        {
                            CommonClasses.WriteLog("User Master", "Delete", "User Master", um_name, Convert.ToInt32(um_code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        }
                        LoadUser();
                    }
                    else
                    {
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "Admin Can Not Be Delete";

                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                        return;
                    }
                }
            }
            else
            {
                ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);

                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                return;
            }
        }
        catch (Exception exc)
        {
            CommonClasses.SendError("User Master", "GridView1_RowEditing", exc.Message);
        }
    }
    protected void dgProcessMaster_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgProcessMaster.Rows[e.RowIndex].FindControl("lblR_CODE"))).Text))
                {
                    string Process_CODE = ((Label)(dgProcessMaster.Rows[e.RowIndex].FindControl("lblR_CODE"))).Text;
                    string Process_NAME = ((Label)(dgProcessMaster.Rows[e.RowIndex].FindControl("lblR_DESC"))).Text;

                    if (CommonClasses.CheckUsedInTran("CASH_BOOK_ENTRY", "C_REMARK_CODE", "AND ES_DELETE=0 ", Process_CODE))
                    {
                        //ShowMessage("#Avisos", "You cant delete this record it has used in State Master", CommonClasses.MSG_Warning);
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You cant delete this record it has used in Cashbook Entry";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                    else
                    {
                        bool flag = CommonClasses.Execute1("UPDATE REMARK_MASTER SET ES_DELETE=1 where R_CODE='" + Process_CODE + "'");
                        if (flag == true)
                        {
                            CommonClasses.WriteLog("Remark Master", "Delete", "Remark Master", Process_NAME, Convert.ToInt32(Process_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);
                        }
                    }
                }
                LoadProcess();
            }



            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You Have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                //ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);
                return;
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Remark Master", "dgProcessMaster_RowDeleting", Ex.Message);
        }
    }
    protected void dgStockAdjustment_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgStockAdjustment.Rows[e.RowIndex].FindControl("lblCode"))).Text))
                {
                    string um_code  = ((Label)(dgStockAdjustment.Rows[e.RowIndex].FindControl("lblCode"))).Text;
                    string um_DOCNO = ((Label)(dgStockAdjustment.Rows[e.RowIndex].FindControl("lblDoc_No"))).Text;

                    bool flag = CommonClasses.Execute1("UPDATE STOCK_ADJUSTMENT_MASTER SET ES_DELETE = 1 WHERE SAM_CODE='" + Convert.ToInt32(um_code) + "'");

                    if (flag == true)
                    {
                        DataTable DtOldDetails = CommonClasses.Execute("select SAD_I_CODE,SAD_ADJUSTMENT_QTY from STOCK_ADJUSTMENT_DETAIL WHERE SAD_SAM_CODE='" + um_code + "'");
                        //DataTable DtREQRef = CommonClasses.Execute("select IM_MATERIAL_REQ from ISSUE_MASTER WHERE IM_CODE='" + um_code + "'");

                        //---- Reseting Item Master Stock
                        for (int n = 0; n < DtOldDetails.Rows.Count; n++)
                        {
                            if (Convert.ToDouble(DtOldDetails.Rows[n]["SAD_ADJUSTMENT_QTY"]) > 0)
                            {
                                CommonClasses.Execute1("UPDATE ITEM_MASTER SET I_CURRENT_BAL=I_CURRENT_BAL-" + DtOldDetails.Rows[n]["SAD_ADJUSTMENT_QTY"] + " where I_CODE='" + DtOldDetails.Rows[n]["SAD_I_CODE"] + "'");
                            }
                            else
                            {
                                CommonClasses.Execute1("UPDATE ITEM_MASTER SET I_CURRENT_BAL=I_CURRENT_BAL+" + Math.Abs(Convert.ToDouble(DtOldDetails.Rows[n]["SAD_ADJUSTMENT_QTY"])) + " where I_CODE='" + DtOldDetails.Rows[n]["SAD_I_CODE"] + "'");
                            }
                        }

                        flag = CommonClasses.Execute1("DELETE FROM STOCK_LEDGER WHERE STL_DOC_NO='" + um_code + "' and STL_DOC_TYPE='STCADJ'");

                        CommonClasses.WriteLog("STOCK Adjustment", "Delete", "STOCK Adjustment", um_DOCNO, Convert.ToInt32(um_code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                    }
                    LoadStockAdjustment();
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You Have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                return;
            }
        }
        catch (Exception exc)
        {
            CommonClasses.SendError("User Master", "GridView1_RowEditing", exc.Message);
        }
    }
    bool Save()
    {
        bool res = false;

        try
        {
            res = CommonClasses.Execute1("INSERT INTO SCRAP_MASTER(SM_CM_CODE,SM_P_CODE,SM_CH_NO,SM_CH_DATE,SM_IWM_NO,SM_IWM_DATE)VALUES('" + Session["CompanyCode"] + "','" + ddlSupplier.SelectedValue + "','" + txtChallanNo.Text + "','" + Convert.ToDateTime(txtChallanDate.Text).ToString("dd/MMM/yyyy") + "','" + txtGRNno.Text + "','" + Convert.ToDateTime(txtGRNDate.Text).ToString("dd/MMM/yyyy") + "')");
            if (res)
            {
                string SD_SM_CODE = CommonClasses.GetMaxId("SELECT MAX(SM_CODE) FROM SCRAP_MASTER");
                for (int i = 0; i < dgInwardMaster.Rows.Count; i++)
                {
                    string SD_I_CODE   = ((Label)dgInwardMaster.Rows[i].FindControl("lblSD_I_CODE")).Text;
                    string SD_REV_QTY  = ((Label)dgInwardMaster.Rows[i].FindControl("lblSD_REV_QTY")).Text;
                    string SD_UOM_CODE = ((Label)dgInwardMaster.Rows[i].FindControl("lblSD_UOM_CODE")).Text;
                    res = CommonClasses.Execute1("INSERT INTO SCRAP_DETAIL (SD_SM_CODE,SD_I_CODE,SD_REV_QTY,SD_UOM_CODE)VALUES('" + SD_SM_CODE + "','" + SD_I_CODE + "','" + SD_REV_QTY + "','" + SD_UOM_CODE + "')");
                    if (res)
                    {
                        double    temQty     = Convert.ToDouble(SD_REV_QTY);
                        DataTable dtBallance = CommonClasses.Execute("SELECT ROUND((IWD_TUR_QTY-IWD_REC_TUR_QTY),3) AS TUR_BAL,IWD_TUR_QTY,IWD_REC_TUR_QTY,IWD_CODE,IWM_CODE,IWD_IWM_CODE,IWD_I_CODE,IWM_NO,IWM_DATE,P_NAME,I_CODENO,I_NAME,IWD_REV_QTY,IWD_TUR_WEIGHT FROM INWARD_DETAIL,ITEM_MASTER,INWARD_MASTER,PARTY_MASTER WHERE IWD_I_CODE=I_CODE AND IWM_CODE=IWD_IWM_CODE AND P_CODE=IWM_P_CODE AND IWD_TUR_WEIGHT > 0 AND P_CODE='" + ddlSupplier.SelectedValue + "' and ROUND((IWD_TUR_QTY-IWD_REC_TUR_QTY),3) >0 ORDER BY  IWM_CODE");
                        double    TurBal     = 0;
                        for (int j = 0; j < dtBallance.Rows.Count; j++)
                        {
                            TurBal = Convert.ToDouble(dtBallance.Rows[j]["TUR_BAL"].ToString());
                            if (TurBal >= temQty)
                            {
                                CommonClasses.Execute("UPDATE INWARD_DETAIL SET IWD_REC_TUR_QTY = IWD_REC_TUR_QTY+ " + temQty + " WHERE IWD_CODE='" + dtBallance.Rows[j]["IWD_CODE"].ToString() + "'");
                                temQty = temQty - temQty;
                            }
                            else
                            {
                                CommonClasses.Execute("UPDATE INWARD_DETAIL SET IWD_REC_TUR_QTY = IWD_REC_TUR_QTY+ " + TurBal + " WHERE IWD_CODE='" + dtBallance.Rows[j]["IWD_CODE"].ToString() + "'");
                                temQty = temQty - TurBal;
                            }
                            if (temQty <= 0)
                            {
                                res = true;
                                break;
                            }
                        }
                    }
                    CommonClasses.Execute("INSERT INTO STOCK_LEDGER(STL_I_CODE,STL_DOC_NO,STL_DOC_NUMBER,STL_DOC_TYPE,STL_DOC_DATE,STL_DOC_QTY)VALUES('" + SD_I_CODE + "','" + SD_SM_CODE + "','" + txtGRNno.Text + "','TURIWD','" + Convert.ToDateTime(txtGRNDate.Text).ToString("dd/MMM/yyyy") + "','" + SD_REV_QTY + "')");
                    CommonClasses.Execute("Update ITEM_MASTER set I_CURRENT_BAL=I_CURRENT_BAL+" + SD_REV_QTY + ",I_RECEIPT_DATE='" + Convert.ToDateTime(txtGRNDate.Text).ToString("dd/MMM/yyyy") + "' where  I_CODE='" + SD_I_CODE + "'");
                }
            }
        }
        catch (Exception)
        {
        }
        return(res);
    }
Beispiel #22
0
    protected void dgIssueToProduction_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgIssueToProduction.Rows[e.RowIndex].FindControl("lblIM_CODE"))).Text))
                {
                    string um_code = ((Label)(dgIssueToProduction.Rows[e.RowIndex].FindControl("lblIM_CODE"))).Text;
                    string um_name = ((Label)(dgIssueToProduction.Rows[e.RowIndex].FindControl("lblIM_NO"))).Text;

                    bool flag = CommonClasses.Execute1("UPDATE ISSUE_MASTER SET ES_DELETE = 1 WHERE IM_CODE='" + Convert.ToInt32(um_code) + "'");

                    if (flag == true)
                    {
                        DataTable DtOldDetails = CommonClasses.Execute("select IMD_I_CODE,IMD_ISSUE_QTY from ISSUE_MASTER_DETAIL WHERE IM_CODE='" + um_code + "'");
                        DataTable DtREQRef     = CommonClasses.Execute("select IM_MATERIAL_REQ from ISSUE_MASTER WHERE IM_CODE='" + um_code + "'");

                        //---- Reseting Item Master Stock
                        for (int n = 0; n < DtOldDetails.Rows.Count; n++)
                        {
                            CommonClasses.Execute1("UPDATE ITEM_MASTER SET I_CURRENT_BAL=I_CURRENT_BAL+" + DtOldDetails.Rows[n]["IMD_ISSUE_QTY"] + " where I_CODE='" + DtOldDetails.Rows[n]["IMD_I_CODE"] + "'");
                            //if (DtREQRef.Rows.Count>0)
                            //{
                            //CommonClasses.Execute1("UPDATE MATERIAL_REQUISITION_DETAIL SET MRD_ISSUE_QTY=MRD_ISSUE_QTY-" + DtOldDetails.Rows[n]["IMD_ISSUE_QTY"] + " where MRD_MR_CODE='" + DtREQRef.Rows[0]["IM_MATERIAL_REQ"] + "' and MRD_I_CODE='" + DtOldDetails.Rows[n]["IMD_I_CODE"] + "'");
                            // }
                        }

                        flag = CommonClasses.Execute1("DELETE FROM STOCK_LEDGER WHERE STL_DOC_NO='" + um_code + "' and STL_DOC_TYPE='ISSPROD'");



                        CommonClasses.WriteLog("Issue To Production", "Delete", "Issue To Production", um_name, Convert.ToInt32(um_code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                    }
                    LoadIssue();
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You Have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                return;
            }
        }
        catch (Exception exc)
        {
            CommonClasses.SendError("User Master", "GridView1_RowEditing", exc.Message);
        }
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgPoTypeMaster.Rows[e.RowIndex].FindControl("lblPO_T_CODE"))).Text))
                {
                    string um_code = ((Label)(dgPoTypeMaster.Rows[e.RowIndex].FindControl("lblPO_T_CODE"))).Text;
                    string um_name = ((Label)(dgPoTypeMaster.Rows[e.RowIndex].FindControl("lblPO_T_SHORT_NAME"))).Text;
                    if (um_code == "-2147483648" || um_code == "-2147483647")
                    {
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "These record is fixed";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                    else if (CommonClasses.CheckUsedInTran("SUPP_PO_MASTER", "SPOM_TYPE", "AND ES_DELETE=0", um_code))
                    {
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You cant delete this record it has used in Purchase Order";
                        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 = CommonClasses.Execute1("UPDATE PO_TYPE_MASTER SET ES_DELETE = 1 WHERE PO_T_CODE='" + Convert.ToInt32(um_code) + "'");

                        if (flag == true)
                        {
                            CommonClasses.WriteLog("Po Type Master", "Delete", "Po Type Master", um_code, Convert.ToInt32(um_code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        }
                        LoadPo();
                    }
                }
            }
            else
            {
                ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);

                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                return;
            }
        }
        catch (Exception exc)
        {
            CommonClasses.SendError("Po Type Master", "GridView1_RowEditing", exc.Message);
        }
    }
    bool SaveRec()
    {
        bool result = false;



        try
        {
            if (Request.QueryString[0].Equals("INSERT"))
            {
                if (checkExist())
                {
                    result = CommonClasses.Execute1("INSERT INTO [dbo].[SERVICE_TYPE_MASTER] ([S_CM_COMP_ID] ,[S_CODENO] ,[S_NAME] ,[S_E_CODE] ,[S_COSTING_HEAD] ,[S_ACCOUNT_SALES] ,[S_ACCOUNT_PURCHASE] ,[S_ACTIVE_IND] ,[ES_DELETE] ,[MODIFY]) VALUES (" + Session["CompanyId"].ToString() + " ,'" + txtServiceCode.Text.Trim().Replace("'", "\''") + "' ,'" + txtServiceName.Text.Trim().Replace("'", "\''") + "' ," + ddlSACCode.SelectedValue + " ,'" + txtCostingHead.Text.Trim().Replace("'", "\''") + "' ," + ddlTallyAccS.SelectedValue + " ," + ddltallyAccP.SelectedValue + ",'" + ChkActiveInd.Checked + "',0 ,0) ");
                    if (result)
                    {
                        Response.Redirect("~/Masters/VIEW/ViewServiceMaster.aspx", false);
                    }
                }
                else
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "Record Already Exist for Service Code or Service Name";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert1();", true);
                }
            }
            else if (Request.QueryString[0].Equals("MODIFY"))
            {
                if (checkExist())
                {
                    result = CommonClasses.Execute1("UPDATE [dbo].[SERVICE_TYPE_MASTER] SET [S_CM_COMP_ID] = " + Session["CompanyId"].ToString() + " ,[S_CODENO] = '" + txtServiceCode.Text.Trim().Replace("'", "\''") + "' ,[S_NAME] = '" + txtServiceName.Text.Trim().Replace("'", "\''") + "' ,[S_E_CODE] = " + ddlSACCode.SelectedValue + " ,[S_COSTING_HEAD] = '" + txtCostingHead.Text.Trim().Replace("'", "\''") + "' ,[S_ACCOUNT_SALES] = " + ddlTallyAccS.SelectedValue + " ,[S_ACCOUNT_PURCHASE] = " + ddltallyAccP.SelectedValue + " ,[S_ACTIVE_IND] = '" + ChkActiveInd.Checked + "'  WHERE S_CODE=" + ViewState["mlCode"] + "");
                    if (result)
                    {
                        Response.Redirect("~/Masters/VIEW/ViewServiceMaster.aspx", false);
                    }
                }
                else
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "Record Already Exist for Service Code or Service Name";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert1();", true);
                }
            }
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Service Type Master", "SaveRec", ex.Message);
        }
        return(result);
    }
    protected void dgDetailPO_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
        {
            if (!ModifyLog(((Label)(dgDetailPO.Rows[e.RowIndex].FindControl("lblIWM_CODE"))).Text))
            {
                try
                {
                    string cpom_code = ((Label)(dgDetailPO.Rows[e.RowIndex].FindControl("lblIWM_CODE"))).Text;



                    bool flag = CommonClasses.Execute1("UPDATE INWARD_MASTER SET ES_DELETE = 1 WHERE IWM_CODE='" + Convert.ToInt32(cpom_code) + "'");
                    if (flag == true)
                    {
                        DataTable dtq = CommonClasses.Execute("SELECT IWD_REV_QTY,IWD_I_CODE,IWD_CPOM_CODE FROM INWARD_DETAIL where IWD_IWM_CODE=" + cpom_code + " ");

                        for (int i = 0; i < dtq.Rows.Count; i++)
                        {
                            CommonClasses.Execute("Update ITEM_MASTER set I_CURRENT_BAL=ISNULL(I_CURRENT_BAL,0)-'" + dtq.Rows[i]["IWD_REV_QTY"].ToString() + "' where I_CODE='" + dtq.Rows[i]["IWD_I_CODE"].ToString() + "'");
                        }
                        CommonClasses.WriteLog("With Out PO With Out PO Material Inward  ", "Delete", "With Out PO Material Inward ", cpom_code, Convert.ToInt32(cpom_code), Convert.ToInt32(Session["CompanyId"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "Record deleted successfully";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                }
                catch (Exception Ex)
                {
                    CommonClasses.SendError("With Out PO Material Inward ", "dgDetailPO_RowDeleting", Ex.Message);
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "Record used by another person";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                return;
            }
            LoadInward();
        }
        else
        {
            PanelMsg.Visible = true;
            lblmsg.Text      = "You have no rights to delete";
            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
            return;
        }
    }
    protected void dgCustomerEnquiry_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
        {
            if (!ModifyLog(((Label)(dgCustomerEnquiry.Rows[e.RowIndex].FindControl("lblINQ_CODE"))).Text))
            {
                string ce_code = ((Label)(dgCustomerEnquiry.Rows[e.RowIndex].FindControl("lblINQ_CODE"))).Text;

                if (CommonClasses.CheckUsedInTran("CUSTPO_MASTER", "CPOM_INQ_CODE", "AND ES_DELETE=0", ce_code))
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "You cant delete this record it has used in Sale Order";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    //ShowMessage("#Avisos", "You cant delete this record it has used in Quotation", CommonClasses.MSG_Warning);
                }
                else
                {
                    bool flag = CommonClasses.Execute1("UPDATE ENQUIRY_MASTER  SET ES_DELETE = 1 WHERE INQ_CODE='" + Convert.ToInt32(ce_code) + "'");
                    if (flag == true)
                    {
                        CommonClasses.WriteLog("Customer Enquiry", "Delete", "Customer Enquiry", ce_code, Convert.ToInt32(ce_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);
                    }
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "Record used by another person";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                return;
            }

            LoadEnquiry();
        }
        else
        {
            PanelMsg.Visible = true;
            lblmsg.Text      = "Record used by another person";
            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
            //ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);
            return;
        }
    }
    protected void dgBatch_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
        {
            if (!ModifyLog(((Label)(dgBatch.Rows[e.RowIndex].FindControl("lblBT_CODE"))).Text))
            {
                string ce_code = ((Label)(dgBatch.Rows[e.RowIndex].FindControl("lblBT_CODE"))).Text;

                if (CommonClasses.CheckUsedInTran("TINTER_SHEET_MASTER", "TSM_BT_CODE", "AND ES_DELETE=0", ce_code))
                {
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "You cant delete this record it has used in Tinter Sheet";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    //ShowMessage("#Avisos", "You cant delete this record it has used in Quotation", CommonClasses.MSG_Warning);
                }
                else
                {
                    bool flag = CommonClasses.Execute1("UPDATE BATCH_MASTER  SET ES_DELETE = 1 WHERE BT_CODE='" + Convert.ToInt32(ce_code) + "'");
                    if (flag == true)
                    {
                        CommonClasses.WriteLog("Batch Ticket", "Delete", "Batch Ticket", ce_code, Convert.ToInt32(ce_code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));

                        PanelMsg.Visible = true;
                        lblmsg.Text      = "Record deleted successfully";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "Record used by another person";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                return;
            }

            LoadBatch();
        }
        else
        {
            PanelMsg.Visible = true;
            lblmsg.Text      = "Record used by another person";
            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
            return;
        }
    }
Beispiel #28
0
    public bool Delete()
    {
        bool result = false;

        try
        {
            DL_DBAccess = new DatabaseAccessLayer();
            //SqlParameter[] Params = { new SqlParameter("@I_CODE", I_CODE) };
            result = CommonClasses.Execute1("UPDATE ITEM_MASTER SET ES_DELETE = 1 WHERE I_CODE='" + I_CODE + "'");
            return(result);
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Finished Product Class", "Delete", ex.Message);
            return(false);
        }
        finally
        { }
    }
Beispiel #29
0
    public bool Delete()
    {
        bool result = false;

        try
        {
            DL_DBAccess = new DatabaseAccessLayer();
            //SqlParameter[] Params = { new SqlParameter("@A_CODE", A_CODE) };
            //result = DL_DBAccess.Insertion_Updation_Delete("SP_AREA_MASTER_Delete", Params);
            result = CommonClasses.Execute1("Update SUPPLIER_TYPE_MASTER set ES_DELETE=1 where STM_CODE=" + STM_CODE + "");
            return(result);
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Area Class", "Delete", ex.Message);
            return(false);
        }
        finally
        { }
    }
Beispiel #30
0
    protected void dgBillofMaterial_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
        {
            if (!ModifyLog(((Label)(dgBillofMaterial.Rows[e.RowIndex].FindControl("lblBM_CODE"))).Text))
            {
                string bm_code  = ((Label)(dgBillofMaterial.Rows[e.RowIndex].FindControl("lblBM_CODE"))).Text;
                string i_name   = ((Label)(dgBillofMaterial.Rows[e.RowIndex].FindControl("lblI_NAME"))).Text;
                string i_code   = ((Label)(dgBillofMaterial.Rows[e.RowIndex].FindControl("lblI_CODENO"))).Text;
                string ItemCode = ((Label)(dgBillofMaterial.Rows[e.RowIndex].FindControl("lblI_CODE"))).Text;
                if (CommonClasses.CheckUsedInTran("MATERIAL_REQUISITION_MASTER", "MR_I_CODE", "AND ES_DELETE=0", ItemCode))
                {
                    //ShowMessage("#Avisos", "You can't delete this record it has used in Components", CommonClasses.MSG_Warning);
                    PanelMsg.Visible = true;
                    lblmsg.Text      = "You can't delete this record it has used in Material Requisition";
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                }
                else
                {
                    bool flag = CommonClasses.Execute1("UPDATE BOM_MASTER SET ES_DELETE = 1 WHERE BM_CODE='" + Convert.ToInt32(bm_code) + "'");
                    if (flag == true)
                    {
                        CommonClasses.WriteLog("Bill Of Material", "Delete", "Bill Of Material", bm_code, Convert.ToInt32(bm_code), Convert.ToInt32(Session["CompanyId"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        ShowMessage("#Avisos", CommonClasses.strRegDelSucesso, CommonClasses.MSG_Erro);

                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                }
                // }
            }

            LoadBOM();
        }
        else
        {
            ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);
            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
            return;
        }
    }