コード例 #1
0
        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;
            }
        }