protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime?NullDate = null;
                foreach (GridViewRow gvRow in GridViewItem.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowPlanCheckBox"));

                    if (rowChkBox.Checked == true)
                    {
                        Label lblInput_Name = ((Label)gvRow.FindControl("lblInput_Name"));

                        TextBox txtProductionDate        = ((TextBox)gvRow.FindControl("txtProductionDate"));
                        TextBox txtDayInput              = ((TextBox)gvRow.FindControl("txtDayInput"));
                        Label   lblAchievementPercentage = ((Label)gvRow.FindControl("lblAchievementPercentage"));

                        DropDownList ddlStatus            = ((DropDownList)gvRow.FindControl("ddlstatus"));
                        DropDownList ddlResponsiblePerson = ((DropDownList)gvRow.FindControl("ddlResponsiblePerson"));
                        TextBox      txtComent            = ((TextBox)gvRow.FindControl("txtComments"));

                        LC_ProductionStatus _LC_ProductionStatus = new LC_ProductionStatus();

                        _LC_ProductionStatus.Order_No          = txtOrder.Text;
                        _LC_ProductionStatus.ProductionProcess = lblInput_Name.Text;
                        _LC_ProductionStatus.Order_No          = txtOrder.Text;

                        if (txtProductionDate.Text == "")
                        {
                            _LC_ProductionStatus.InputDate = NullDate;
                        }
                        else
                        {
                            _LC_ProductionStatus.InputDate = Convert.ToDateTime(txtProductionDate.Text);
                        }
                        _LC_ProductionStatus.DayInput = Convert.ToDouble(txtDayInput.Text);
                        _LC_ProductionStatus.AchievementPercentage = Convert.ToDouble(lblAchievementPercentage.Text);

                        _LC_ProductionStatus.Responsible_Person = ddlResponsiblePerson.Text;
                        _LC_ProductionStatus.Status             = ddlStatus.Text;
                        _LC_ProductionStatus.EditDate           = DateTime.Today;
                        _LC_ProductionStatus.EditUser           = ((SessionUser)Session["SessionUser"]).UserId;
                        _LC_ProductionStatus.Create_Date        = DateTime.Today;
                        _LC_ProductionStatus.Create_User        = ((SessionUser)Session["SessionUser"]).UserId;
                        _LC_ProductionStatus.OCode = ((SessionUser)Session["SessionUser"]).OCode;

                        int result1 = masterBLL.InsertProductionStatus(_LC_ProductionStatus);
                    }
                }

                lblMessageUpdate.Text = "Data Update Successfully";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void GridViewItem_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = GridViewItem.Rows[e.RowIndex];

            DateTime?NullDate = null;

            Label lblID = (Label)row.FindControl("lblID");
            int   ID    = Convert.ToInt32(lblID.Text);

            TextBox      txtProductionDate        = ((TextBox)row.FindControl("txtProductionDate"));
            TextBox      txtDayInput              = ((TextBox)row.FindControl("txtDayInput"));
            Label        lblAchievementPercentage = ((Label)row.FindControl("lblAchievementPercentage"));
            DropDownList ddlStatus           = ((DropDownList)row.FindControl("ddlStatus"));
            DropDownList ddlResposiblePerson = ((DropDownList)row.FindControl("ddlResposiblePerson"));
            TextBox      txtComments         = ((TextBox)row.FindControl("txtComments"));

            LC_ProductionStatus _LC_ProductionStatus = new LC_ProductionStatus();

            _LC_ProductionStatus.Order_No = txtOrder.Text;


            if (txtProductionDate.Text == "")
            {
                _LC_ProductionStatus.InputDate = NullDate;
            }
            else
            {
                _LC_ProductionStatus.InputDate = Convert.ToDateTime(txtProductionDate.Text);
            }
            _LC_ProductionStatus.DayInput = Convert.ToDouble(txtDayInput.Text);
            _LC_ProductionStatus.AchievementPercentage = Convert.ToDouble(lblAchievementPercentage.Text);

            _LC_ProductionStatus.Responsible_Person = ddlResposiblePerson.SelectedValue;
            _LC_ProductionStatus.Status             = ddlStatus.SelectedValue;
            _LC_ProductionStatus.Comments           = txtComments.Text;
            _LC_ProductionStatus.EditDate           = DateTime.Today;
            _LC_ProductionStatus.EditUser           = ((SessionUser)Session["SessionUser"]).UserId;
            _LC_ProductionStatus.OCode = ((SessionUser)Session["SessionUser"]).OCode;

            int result1 = masterBLL.UpdateProductionStutas(_LC_ProductionStatus, ID);

            if (result1 == 1)
            {
                GridViewItem.EditIndex = -1;
                LoadProductionProccess();
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
            }
        }
Esempio n. 3
0
 internal int InsertProductionStatus(LC_ProductionStatus _LC_ProductionStatus)
 {
     return(_masterlcDAL.InsertProductionStatus(_LC_ProductionStatus));
 }
Esempio n. 4
0
 internal int UpdateProductionStutas(LC_ProductionStatus _LC_ProductionStatus, int ID)
 {
     return(_masterlcDAL.UpdateProductionStutas(_LC_ProductionStatus, ID));
 }