Beispiel #1
0
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            double BB, CB;
            BB = Convert.ToDouble(txtbookbal.Text);
            CB = Convert.ToDouble(txtclsgbal.Text);
            if (txtprdcode.Text == "")
            {
                WebMsgBox.Show("Please enter Product code..!!", this.Page);
                txtprdcode.Focus();
                return;
            }

            if (txtaccno.Text == "")
            {
                WebMsgBox.Show("Please enter Account No..!!", this.Page);
                txtaccno.Focus();
                return;
            }

            if (txtdesc.Text == "")
            {
                WebMsgBox.Show("Please enter Description..!!", this.Page);
                txtdesc.Focus();
                return;
            }

            if (txtasstno.Text == "")
            {
                WebMsgBox.Show("Please enter Type Of Assest..!!", this.Page);
                txtasstno.Focus();
                return;
            }

            if (txtstatusno.Text == "")
            {
                WebMsgBox.Show("Please enter Status No..!!", this.Page);
                txtstatusno.Focus();
                return;
            }

            if (txtsanctnno.Text == "")
            {
                WebMsgBox.Show("Please enter Sanction No..!!", this.Page);
                txtsanctnno.Focus();
                return;
            }

            if (txtvendorname.Text == "")
            {
                WebMsgBox.Show("Please enter Vendor's Name..!!", this.Page);
                txtvendorname.Focus();
                return;
            }

            if (txtperiod.Text == "")
            {
                WebMsgBox.Show("Please enter Period..!!", this.Page);
                txtperiod.Focus();
                return;
            }

            if (txtitemno.Text == "")
            {
                WebMsgBox.Show("Please enter Item No..!!", this.Page);
                txtitemno.Focus();
                return;
            }

            if (txtitemtypeno.Text == "")
            {
                WebMsgBox.Show("Please enter Type Of Item..!!", this.Page);
                txtitemtypeno.Focus();
                return;
            }
            if (TxtIdCode.Text == "")
            {
                WebMsgBox.Show("Please enterId code..!!", this.Page);
                TxtIdCode.Focus();
                return;
            }

            if (ddlbranchname.SelectedValue == "0")
            {
                WebMsgBox.Show("Please Select Branch/Dept..!!", this.Page);
                ddlbranchname.Focus();
                return;
            }

            if (txtname.Text == "")
            {
                WebMsgBox.Show("Please enter Name..!!", this.Page);
                txtname.Focus();
                return;
            }

            if (ddlwaranty.SelectedValue == "0")
            {
                WebMsgBox.Show("Please Select Waranty/Guaranty..!!", this.Page);
                ddlwaranty.Focus();
                return;
            }

            if (txtamcdetail.Text == "")
            {
                WebMsgBox.Show("Please enter AMC Details..!!", this.Page);
                txtamcdetail.Focus();
                return;
            }

            if (txtvalue.Text == "")
            {
                WebMsgBox.Show("Please enter Value..!!", this.Page);
                txtvalue.Focus();
                return;
            }

            if (txtbillno.Text == "")
            {
                WebMsgBox.Show("Please enter Bill No..!!", this.Page);
                txtbillno.Focus();
                return;
            }

            if (txtbilldate.Text == "")
            {
                WebMsgBox.Show("Please enter Bill Date..!!", this.Page);
                txtbilldate.Focus();
                return;
            }

            if (ddlAstLoc.SelectedValue == "0")
            {
                WebMsgBox.Show("Please Select Assest Location Code..!!", this.Page);
                ddlAstLoc.Focus();
                return;
            }

            if (txtasublocno.Text == "")
            {
                WebMsgBox.Show("Please enter  Assest Sub  Location Code..!!", this.Page);
                txtasublocno.Focus();
                return;
            }



            if (txtassestdesc.Text == "")
            {
                WebMsgBox.Show("Please enter Assest Description..!!", this.Page);
                txtassestdesc.Focus();
                return;
            }

            if (txtpurchasedate.Text == "")
            {
                WebMsgBox.Show("Please enter Purchase Date..!!", this.Page);
                txtpurchasedate.Focus();
                return;
            }

            if (txtentrydate.Text == "")
            {
                WebMsgBox.Show("Please enter EntryDate..!!", this.Page);
                txtentrydate.Focus();
                return;
            }

            if (txtquantity.Text == "")
            {
                WebMsgBox.Show("Please enter Quality..!!", this.Page);
                txtquantity.Focus();
                return;
            }

            if (TxtValueUnit.Text == "")
            {
                WebMsgBox.Show("Please enter Value unit..!!", this.Page);
                TxtValueUnit.Focus();
                return;
            }

            if (Txtpurchase.Text == "")
            {
                WebMsgBox.Show("Please enter  Purchase Value..!!", this.Page);
                Txtpurchase.Focus();
                return;
            }

            if (txtvalason.Text == "")
            {
                WebMsgBox.Show("Please enter Value As On Date..!!", this.Page);
                txtvalason.Focus();
                return;
            }

            if (txtperdep.Text == "")
            {
                WebMsgBox.Show("Please enter PerDep..!!", this.Page);
                txtperdep.Focus();
                return;
            }

            if (txtdepno.Text == "")
            {
                WebMsgBox.Show("Please enter Dep No..!!", this.Page);
                txtdepno.Focus();
                return;
            }

            if (txtbookbal.Text == "")
            {
                WebMsgBox.Show("Please enter Book Balance..!!", this.Page);
                txtbookbal.Focus();
                return;
            }


            if (ViewState["Flag"].ToString() == "AD")
            {
                if (BB == CB)
                {
                    if (CB != 0.0)
                    {
                        int Result = DS.Insertdata(Session["BRCD"].ToString(), txtprdcode.Text, txtaccno.Text, txtdesc.Text, txtasstno.Text, txtasstname.Text, txtdate.Text, txtstatusno.Text, DDLstatusname.SelectedItem.Text, txtsanctnno.Text, DDlSanction.SelectedItem.Text, txtvendorname.Text,
                                                   txtperiod.Text, txtitemno.Text, DDlitemno.SelectedItem.Text, txtitemtypeno.Text, DDltypeofitm.SelectedItem.Text, TxtIdCode.Text, txtbrnchno.Text, txtname.Text, ddlwaranty.SelectedValue,
                                                   txtamcdetail.Text, txtvalue.Text, txtbillno.Text, txtbilldate.Text, txtchequeno.Text, txtchequedate.Text, txtalocno.Text, DDlASL.SelectedItem.Text, txtasublocno.Text, txtassestdesc.Text,
                                                   txtpurchasedate.Text, txtentrydate.Text, txtquantity.Text, TxtValueUnit.Text, Txtpurchase.Text, txtvalason.Text, txtperdep.Text, txtdepno.Text, DDlDep.SelectedItem.Text, txtbookbal.Text, txtclsgbal.Text, "1001", "Insert", Session["MID"].ToString());
                        if (Result > 0)
                        {
                            WebMsgBox.Show("Data Added successfully..!!", this.Page);
                            BindGrid("PA");
                            FL = "Insert";//Dhanya Shetty
                            string Result1 = CLM.LOGDETAILS(FL, Session["BRCD"].ToString(), Session["MID"].ToString(), "Deadstock_Add _" + txtprdcode.Text + "_" + txtaccno.Text + "_" + Session["LOGINCODE"].ToString() + "", "00", Session["MID"].ToString());
                            ClearData();
                            return;
                        }
                    }
                    else
                    {
                        WebMsgBox.Show("There is no balance..!!", this.Page);
                        return;
                    }
                }
                else
                {
                    WebMsgBox.Show("Book Balance does not match..!!", this.Page);
                    txtbookbal.Text = "";
                    return;
                }
            }
            else if (ViewState["Flag"].ToString() == "MD")
            {
                if (BB == CB)
                {
                    int Result = DS.ModifyData(Session["BRCD"].ToString(), txtprdcode.Text, txtaccno.Text, txtdesc.Text, txtasstno.Text, txtasstname.Text, txtdate.Text, txtstatusno.Text, DDLstatusname.SelectedItem.Text, txtsanctnno.Text, DDlSanction.SelectedItem.Text, txtvendorname.Text,
                                               txtperiod.Text, txtitemno.Text, DDlitemno.SelectedItem.Text, txtitemtypeno.Text, DDltypeofitm.SelectedItem.Text, TxtIdCode.Text, txtbrnchno.Text, txtname.Text, ddlwaranty.SelectedValue,
                                               txtamcdetail.Text, txtvalue.Text, txtbillno.Text, txtbilldate.Text, txtchequeno.Text, txtchequedate.Text, txtalocno.Text, DDlASL.SelectedItem.Text, txtasublocno.Text, txtassestdesc.Text,
                                               txtpurchasedate.Text, txtentrydate.Text, txtquantity.Text, TxtValueUnit.Text, Txtpurchase.Text, txtvalason.Text, txtperdep.Text, txtdepno.Text, DDlDep.SelectedItem.Text, txtbookbal.Text, txtclsgbal.Text, "1002", "Modify", Session["MID"].ToString(), ViewState["Id"].ToString());
                    if (Result > 0)
                    {
                        WebMsgBox.Show("Data Modified successfully..!!", this.Page);
                        BindGrid("PA");
                        FL = "Insert";//Dhanya Shetty
                        string Result1 = CLM.LOGDETAILS(FL, Session["BRCD"].ToString(), Session["MID"].ToString(), "Deadstock_Mod _" + txtprdcode.Text + "_" + txtaccno.Text + "_" + Session["LOGINCODE"].ToString() + "", "00", Session["MID"].ToString());
                        ClearData();
                        return;
                    }
                }
                else
                {
                    WebMsgBox.Show("Book Balance does not match..!!", this.Page);
                    txtbookbal.Text = "";
                    return;
                }
            }
            else if (ViewState["Flag"].ToString() == "DL")
            {
                if (CB == 0)
                {
                    string AT = DS.GetStage(Session["BRCD"].ToString(), txtprdcode.Text, txtaccno.Text);
                    if (AT == "1003")
                    {
                        if (ViewState["Flag"].ToString() == "DL")
                        {
                            WebMsgBox.Show("Record Already Authorized, You cannot delete !", this.Page);
                            return;
                        }
                    }
                    int Result = DS.DeleteData(Session["BRCD"].ToString(), txtprdcode.Text, txtaccno.Text, "1004", "Delete", Session["MID"].ToString(), ViewState["Id"].ToString());
                    if (Result > 0)
                    {
                        WebMsgBox.Show("Data Deleted successfully..!!", this.Page);
                        BindGrid("PA");
                        FL = "Insert";//Dhanya Shetty
                        string Result1 = CLM.LOGDETAILS(FL, Session["BRCD"].ToString(), Session["MID"].ToString(), "Deadstock_Delete _" + txtprdcode.Text + "_" + txtaccno.Text + "_" + Session["LOGINCODE"].ToString() + "", "00", Session["MID"].ToString());
                        ClearData();
                        return;
                    }
                }
                else
                {
                    WebMsgBox.Show("There is closing balance ,You cannot delete !!", this.Page);
                    ClearData();
                    return;
                }
            }
            else if (ViewState["Flag"].ToString() == "AT")
            {
                if (BB == CB)
                {
                    string AT = DS.GetStage(Session["BRCD"].ToString(), txtprdcode.Text, txtaccno.Text);
                    if (AT == "1003")
                    {
                        if (ViewState["Flag"].ToString() == "AT")
                        {
                            WebMsgBox.Show("Record Already Authorized!", this.Page);
                            return;
                        }
                    }
                    int Result = DS.AuthoriseData(Session["BRCD"].ToString(), txtprdcode.Text, txtaccno.Text, "1003", "Autho", Session["MID"].ToString(), ViewState["Id"].ToString());
                    if (Result > 0)
                    {
                        WebMsgBox.Show("Data Authorized successfully..!!", this.Page);
                        BindGrid("PA");
                        FL = "Insert";//Dhanya Shetty
                        string Result1 = CLM.LOGDETAILS(FL, Session["BRCD"].ToString(), Session["MID"].ToString(), "Deadstock_Auto _" + txtprdcode.Text + "_" + txtaccno.Text + "_" + Session["LOGINCODE"].ToString() + "", "00", Session["MID"].ToString());
                        ClearData();
                        return;
                    }
                }
                else
                {
                    WebMsgBox.Show("Book Balance does not match..!!", this.Page);
                    txtbookbal.Text = "";
                    return;
                }
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }
Beispiel #2
0
 protected void TxtValueUnit_TextChanged(object sender, EventArgs e)
 {
     Txtpurchase.Focus();
 }