public void GetMachineStartingConditionDetails() { bmachine = new BMachineStartingCondition(); DataSet DS = new DataSet(); DS = bmachine.GetMachineStartingConditionDetails(); if (!Comman.Comman.IsDataSetEmpty(DS)) { RpMachineStartingCondition.DataSource = DS; RpMachineStartingCondition.DataBind(); } }
public void GetMachineStartingConditionDetails(int MachineStartingConditionId) { DataSet DS = new DataSet(); bmachine = new BMachineStartingCondition(); DS = bmachine.GetMachineStartingConditionDetailsById(MachineStartingConditionId); if (!Comman.Comman.IsDataSetEmpty(DS)) { //{ // string DATE = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MachineStartingConditiondDate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MachineStartingConditiondDate"].ToString(); // //sky // if (DATE == "") // { // txtDate.Text = Convert.ToString(DateTime.Now.ToString("yyy-MM-dd")); // } // else // { // DateTime date1 = Convert.ToDateTime(DATE, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat); // txtDate.Text = (Convert.ToDateTime(date1).ToString("yyyy-MM-dd")); // } dpShiftDetails.ClearSelection(); } if (dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["MachineStartingConditionShiftId"]).ToString()) != null) { dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["MachineStartingConditionShiftId"]).ToString()).Selected = true; } txtMachineName.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MachineName"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MachineName"].ToString(); txtPasteurizer1.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Pasteurizer1"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Pasteurizer1"].ToString(); txtPasteurizer2.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Pasteurizer2"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Pasteurizer2"].ToString(); txtHomogenizer1.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Homogenizer1"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Homogenizer1"].ToString(); txtHomogenizer2.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Homogenizer2"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Homogenizer2"].ToString(); txtSeparatorPump.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SeparatorPump"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["SeparatorPump"].ToString(); txtBDTill.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BDTill"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BDTill"].ToString(); txtReport.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Report"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Report"].ToString(); txtService.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Service"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Service"].ToString(); txtPending.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Pending"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Pending"].ToString(); dpStatusDetails.ClearSelection(); if (dpStatusDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["MachineConditionStatus"]).ToString()) != null) { dpStatusDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["MachineConditionStatus"]).ToString()).Selected = true; } }
protected void btnAdd_Click(object sender, EventArgs e) { mmachine = new MMachineStartingCondition(); bmachine = new BMachineStartingCondition(); int Result = 0; mmachine.MachineStartingConditionId = 0; mmachine.MachineStartingConditiondDate = Convert.ToDateTime(txtDate.Text.ToString()); mmachine.MachineStartingConditionShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); mmachine.MachineName = txtMachineName.Text; mmachine.Pasteurizer1 = string.IsNullOrEmpty(txtPasteurizer1.Text) ? 0 : Convert.ToInt32(txtPasteurizer1.Text); mmachine.Pasteurizer2 = string.IsNullOrEmpty(txtPasteurizer2.Text) ? 0 : Convert.ToInt32(txtPasteurizer2.Text); mmachine.Homogenizer1 = string.IsNullOrEmpty(txtHomogenizer1.Text) ? 0 : Convert.ToInt32(txtHomogenizer1.Text); mmachine.Homogenizer2 = string.IsNullOrEmpty(txtHomogenizer2.Text) ? 0 : Convert.ToInt32(txtHomogenizer2.Text); mmachine.SeparatorPump = txtSeparatorPump.Text; mmachine.BDTill = txtBDTill.Text; mmachine.Service = txtService.Text; mmachine.Pending = txtPending.Text; mmachine.Report = txtReport.Text; mmachine.MachineConditionStatus = Convert.ToInt32(dpStatusDetails.SelectedItem.Value); mmachine.flag = "Insert"; Result = bmachine.machinedata(mmachine); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Machine Starting Condition Data Add Successfully"; pnlError.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "sel3", "$('#bx1').removeClass('collapsed-box');", true); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } }