Пример #1
0
        protected void btnUpdateBudgetCode_Click(object sender, EventArgs e)
        {
            POMain poMain = new POMain();

            try
            {
                poMain.BudgetCodeID          = Convert.ToInt32(lblBudgetCodeID.Text);
                poMain.DepartmentID          = Convert.ToInt32(ddlDepartment.SelectedValue);
                poMain.OrderClassificationID = Convert.ToInt32(ddlOrderClassification.SelectedValue);
                poMain.StationID             = ddlStation.SelectedValue != "0" ? Convert.ToInt32(ddlStation.SelectedValue) : 0;
                poMain.BudgetCodeDescription = txtDescription.Text;
                poMain.CreatedBy             = userName;
                poMain.Received = true;

                int retOut = poMain.UpdateBudgetCode(poMain);

                if (retOut == 1)
                {
                    ControlState();
                    lblUpdateMessage.Visible   = true;
                    lblUpdateMessage.Text      = "";
                    lblUpdateMessage.ForeColor = System.Drawing.Color.Green;
                    lblUpdateMessage.Text      = "Data Successfully Updated";
                }

                else
                {
                    lblMessageError.Visible   = true;
                    lblMessageError.Text      = "";
                    lblMessageError.ForeColor = System.Drawing.Color.Red;
                    lblMessageError.Text      = "Failed while Updating Data" + lblBudgetCodeID.Text;
                }
            }

            catch (Exception ex)
            {
                MessageError              = ex.Message.ToString();
                lblMessageError.Text      = "";
                lblMessageError.ForeColor = System.Drawing.Color.Red;
                lblMessageError.Text      = "<b>Your Transaction Failed: </b>" + MessageError;
            }
        }
Пример #2
0
        protected void btnDeleteBudgetCode_Click(object sender, EventArgs e)
        {
            POMain poMain = new POMain();

            try
            {
                poMain.BudgetCodeID = Convert.ToInt32(lblBudgetCodeID.Text);
                poMain.Received     = false;
                poMain.CreatedBy    = userName;

                int retOut = poMain.UpdateBudgetCode(poMain);
                lblMessageError.Visible = true;

                if (retOut == 1)
                {
                    ControlState();
                    lblUpdateMessage.Visible   = true;
                    lblUpdateMessage.Text      = "";
                    lblUpdateMessage.ForeColor = System.Drawing.Color.Green;
                    lblUpdateMessage.Text      = "Data Successfully Deleted";
                }

                else
                {
                    lblMessageError.Text      = "";
                    lblMessageError.ForeColor = System.Drawing.Color.Red;
                    lblMessageError.Text      = "Data Deletion Failed " + lblBudgetCodeID.Text;
                }
            }

            catch (Exception ex)
            {
                MessageError              = ex.Message.ToString();
                lblMessageError.Text      = "";
                lblMessageError.ForeColor = System.Drawing.Color.Red;
                lblMessageError.Text      = "<b>Your Transaction Failed: </b>" + MessageError;
            }
        }