Beispiel #1
0
        public void btnConfirm_Click(object sender, System.EventArgs e)
        {
            if (SCounter > 0)
            {
                return;
            }
            SCounter++;
            int      RetVal     = 0;
            int      Company    = 0;
            string   Department = "";
            string   Nominal    = "";
            string   Coding     = "";
            string   Project    = "";
            Approval oApproval  = new Approval();

            Company    = Convert.ToInt32(ddlCompany.SelectedValue);
            Department = txtDept.Text.ToString();
            Nominal    = txtNominal.Text.ToString();
            Coding     = txtCodingDes.Text.ToString();
            Project    = txtProject.Text.ToString();


            RetVal = oApproval.InsertDataIntoCodingDescription(Company, Department, Nominal, Project, Coding, ddlAPAdmin.SelectedValue.ToString());
            if (RetVal == 101)
            {
                lblMessage.Text = "Project/Capex inserted successfully.";
                Response.Write("<script>alert('Project/Capex inserted successfully.');</script>");
            }
            else if (RetVal == 1011)
            {
                lblMessage.Text = "Project/Capex already exists.";
                Response.Write("<script>alert('Project/Capex already exists.');</script>");
            }
            else if (RetVal == 102)
            {
                lblMessage.Text = "Nominal Code inserted successfully.";
                Response.Write("<script>alert('Nominal Code inserted successfully.');</script>");
            }
            else if (RetVal == 1021)
            {
                lblMessage.Text = "Nominal Code already exists.";
                Response.Write("<script>alert('Nominal Code already exists.');</script>");
            }
            else if (RetVal == 103)
            {
                lblMessage.Text = "Department inserted successfully.";
                Response.Write("<script>alert('Department inserted successfully.');</script>");
            }
            else if (RetVal == 1031)
            {
                lblMessage.Text = "Department already exists.";
                Response.Write("<script>alert('Department already exists.');</script>");
            }
            else if (RetVal == 105)
            {
                lblMessage.Text = "Record(s) saved successfully.";
                Response.Write("<script>alert('Record(s) saved successfully.');</script>");
            }
            else if (RetVal == 106)
            {
                lblMessage.Text = "Existing record(s) updated successfully.";
                Response.Write("<script>alert('Existing record(s) updated successfully.');</script>");
            }
        }
Beispiel #2
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            int      RetVal     = 0;
            int      Company    = 0;
            string   Department = "";
            string   Nominal    = "";
            string   Coding     = "";
            string   Project    = "";
            Approval oApproval  = new Approval();

            Company    = Convert.ToInt32(ddlCompany.SelectedValue);
            Department = txtDept.Text.ToString();
            Nominal    = txtNominal.Text.ToString();
            Coding     = txtCodingDes.Text.ToString();
            Project    = txtProject.Text.ToString();

            if (Department == "" && Nominal == "" && Coding == "" && Project == "")
            {
                lblMessage.Text = "Please insert atleast one more field.";
                Response.Write("<script>alert('Please insert atleast one more field.');</script>");
                return;
            }
            if (Department != "" && Nominal != "" && Coding == "")
            {
                lblMessage.Text = "Please enter a Coding Description.";
                Response.Write("<script>alert('Please enter a Coding Description.');</script>");
                return;
            }
            if (Department == "" && Nominal == "" && Coding != "")
            {
                lblMessage.Text = "Please enter Department AND Nominal.";
                Response.Write("<script>alert('Please enter Department AND Nominal.');</script>");
                return;
            }
            if (Department != "" && Nominal == "" && Coding != "")
            {
                lblMessage.Text = "Please enter Department AND Nominal.";
                Response.Write("<script>alert('Please enter Department AND Nominal.');</script>");
                return;
            }
            if (Department == "" && Nominal != "" && Coding != "")
            {
                lblMessage.Text = "Please enter Department AND Nominal.";
                Response.Write("<script>alert('Please enter Department AND Nominal.');</script>");
                return;
            }
            int Count = 0;

            Count = oApproval.DataExistsInTable(Company, Department, Nominal);
            if (Count > 0)
            {
                Page.RegisterStartupScript("Reg", "<script>ConfirmResubmit();</script>");
            }
            else
            {
                btnConfirm_Click(sender, e);
            }



            //			if(Count >0)
            //			{
            //				if(ViewState["COUNT"]== null)
            //				{
            //					lblMessage.Text = "This code combination is already in the system. Please continue if you wish to change the Coding Description.";
            //					Response.Write("<script>alert('This code combination is already in the system. Please continue if you wish to change the Coding Description.');</script>");
            //					ViewState["COUNT"]="1";
            //					return;
            //				}
            //			}
            //
            //			RetVal = oApproval.InsertDataIntoCodingDescription(Company,Department,Nominal,Project,Coding,ddlAPAdmin.SelectedValue.ToString());
            //			if(RetVal == 101)
            //			{
            //				lblMessage.Text = "Project/Capex inserted successfully.";
            //				Response.Write("<script>alert('Project/Capex inserted successfully.');</script>");
            //			}
            //			else if(RetVal == 1011)
            //			{
            //				lblMessage.Text = "Project/Capex already exists.";
            //				Response.Write("<script>alert('Project/Capex already exists.');</script>");
            //			}
            //			else if(RetVal == 102)
            //			{
            //				lblMessage.Text = "Nominal Code inserted successfully.";
            //				Response.Write("<script>alert('Nominal Code inserted successfully.');</script>");
            //			}
            //			else if(RetVal == 1021)
            //			{
            //				lblMessage.Text = "Nominal Code already exists.";
            //				Response.Write("<script>alert('Nominal Code already exists.');</script>");
            //			}
            //			else if(RetVal == 103)
            //			{
            //				lblMessage.Text = "Department inserted successfully.";
            //				Response.Write("<script>alert('Department inserted successfully.');</script>");
            //			}
            //			else if(RetVal == 1031)
            //			{
            //				lblMessage.Text = "Department already exists.";
            //				Response.Write("<script>alert('Department already exists.');</script>");
            //			}
            //			else if(RetVal == 105)
            //			{
            //				lblMessage.Text = "Record(s) saved successfully.";
            //				Response.Write("<script>alert('Record(s) saved successfully.');</script>");
            //			}
            //			else if(RetVal == 106)
            //			{
            //				lblMessage.Text = "Existing record(s) updated successfully.";
            //				Response.Write("<script>alert('Existing record(s) updated successfully.');</script>");
            //			}
        }