protected void btnAdd_Click(object sender, EventArgs e) { { mpast = new MPastProcess(); bpast = new BPastProcess(); int Result = 0; mpast.pastProcessId = 0; mpast.RMRId = string.IsNullOrEmpty(hId.Value) ? 0 : Convert.ToInt32(hId.Value); foreach (RepeaterItem item in rpPastProcessList.Items) { HiddenField hdfID = item.FindControl("hfStdId") as HiddenField; if (hdfID != null) { mpast.StdId = string.IsNullOrEmpty(hdfID.Value) ? 0 : Convert.ToInt32(hdfID.Value); } } mpast.PastProcessDate = Convert.ToDateTime(txtDate.Text).ToString("dd-MM-yyyy"); mpast.PastShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); mpast.IBTTemperature = string.IsNullOrEmpty(txtIBTTemperature.Text) ? 0 : Convert.ToDouble(txtIBTTemperature.Text); mpast.PastStartTime = string.IsNullOrEmpty(txtPasteurizationstarttime.Text) ? string.Empty : txtPasteurizationstarttime.Text; mpast.PastTempHeat1 = string.IsNullOrEmpty(txtHeatFirst.Text) ? 0 : Convert.ToDouble(txtHeatFirst.Text); mpast.Cool1 = string.IsNullOrEmpty(txtCool1.Text) ? 0 : Convert.ToDouble(txtCool1.Text); mpast.PastTempHeat2 = string.IsNullOrEmpty(txtHeatSecond.Text) ? 0 : Convert.ToDouble(txtHeatSecond.Text); mpast.Cool2 = string.IsNullOrEmpty(txtCool2.Text) ? 0 : Convert.ToDouble(txtCool2.Text); mpast.PastTempHeat3 = string.IsNullOrEmpty(txtHeatThird.Text) ? 0 : Convert.ToDouble(txtHeatThird.Text); mpast.Cool3 = string.IsNullOrEmpty(txtCool3.Text) ? 0 : Convert.ToDouble(txtCool3.Text); mpast.PastTempHeat4 = string.IsNullOrEmpty(txtHeatForth.Text) ? 0 : Convert.ToDouble(txtHeatForth.Text); mpast.Cool4 = string.IsNullOrEmpty(txtCool4.Text) ? 0 : Convert.ToDouble(txtCool4.Text); mpast.PastTempHeat5 = string.IsNullOrEmpty(txtHeatFive.Text) ? 0 : Convert.ToDouble(txtHeatFive.Text); mpast.Cool5 = string.IsNullOrEmpty(txtCool5.Text) ? 0 : Convert.ToDouble(txtCool5.Text); mpast.MilkClosingTime = string.IsNullOrEmpty(txtMilkClosingTime.Text) ? string.Empty : txtMilkClosingTime.Text; mpast.DoneBy = string.IsNullOrEmpty(txtDoneBy.Text) ? string.Empty : txtDoneBy.Text; mpast.pastProcessStatusId = Convert.ToInt32(dpPastProcessDone.SelectedItem.Value); mpast.flag = "Insert"; Result = bpast.pastdata(mpast); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "PasteurizationProcess Data Add Successfully"; ScriptManager.RegisterStartupScript(this, this.GetType(), "sel3", "$('#bx1').addClass('collapsed-box');", true); pnlError.Update(); string dates; dates = string.IsNullOrEmpty(txtSearchDate.Text) ? string.Empty: Convert.ToDateTime(txtSearchDate.Text).ToString("dd-MM-yyyy"); GetPastDetails(dates); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } //return Result; } }
public void GetPastDetails(string dates) { bpast = new BPastProcess(); DataSet DS = new DataSet(); DS = bpast.GetPastDetails(dates); if (!Comman.Comman.IsDataSetEmpty(DS)) { rpPastProcessList.DataSource = DS; rpPastProcessList.DataBind(); } else { DS.Clear(); rpPastProcessList.DataSource = DS; rpPastProcessList.DataBind(); } }
public void GetPastDetails(RMRecieve R) { bpast = new BPastProcess(); DataSet DS = new DataSet(); DS = bpast.GetPastDetails(R); if (!Comman.Comman.IsDataSetEmpty(DS)) { rpPastProcessList.DataSource = DS; rpPastProcessList.DataBind(); } else if (DS.Tables[0].Rows.Count == 0) { //this.BindRepeater(dt); rpPastProcessList.DataSource = DS; rpPastProcessList.DataBind(); } }
public void GetPastDetails(int RMRId) { DataSet DS = new DataSet(); bpast = new BPastProcess(); DS = bpast.GetPastDetailsbyId(RMRId); if (!Comman.Comman.IsDataSetEmpty(DS)) { string DATE = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["StandardDate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["StandardDate"].ToString(); //sky DateTime date1 = Convert.ToDateTime(DATE, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat); txtDate.Text = (Convert.ToDateTime(date1).ToString("yyyy-MM-dd")); txtBatchNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BatchNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BatchNo"].ToString(); //txtDate.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Date"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Date"].ToString(); //dpShiftDetails.SelectedValue = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ShiftId"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ShiftId"].ToString(); dpShiftDetails.ClearSelection(); try { dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["PastShiftId"]).ToString()).Selected = true; } catch (InvalidCastException) { if (dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["StdShiftId"]).ToString()) != null) { dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["StdShiftId"]).ToString()).Selected = true; } } txtIBTTemperature.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["IBTTemperature"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["IBTTemperature"].ToString(); if (DS.Tables[0].Rows[0]["PastStartTime"].ToString() == "") { txtPasteurizationstarttime.Text = Convert.ToString(DateTime.Now.ToString("HH:mm")); } else { txtPasteurizationstarttime.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["PastStartTime"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["PastStartTime"].ToString(); } txtHeatFirst.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["PastTempHeat1"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["PastTempHeat1"].ToString(); txtCool1.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Cool1"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Cool1"].ToString(); txtHeatSecond.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["PastTempHeat2"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["PastTempHeat2"].ToString(); txtCool2.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Cool2"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Cool2"].ToString(); txtHeatThird.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["PastTempHeat3"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["PastTempHeat3"].ToString(); txtCool3.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Cool3"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Cool3"].ToString(); txtHeatForth.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["PastTempHeat4"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["PastTempHeat4"].ToString(); txtCool4.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Cool4"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Cool4"].ToString(); txtHeatFive.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["PastTempHeat5"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["PastTempHeat5"].ToString(); txtCool5.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Cool5"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Cool5"].ToString(); txtMilkClosingTime.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MilkClosingTime"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MilkClosingTime"].ToString(); txtDoneBy.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["DoneBy"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["DoneBy"].ToString(); dpPastProcessDone.ClearSelection(); string PastProcessDone = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["PastProcessStatusId"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["PastProcessStatusId"].ToString(); if (PastProcessDone == "") { dpPastProcessDone.SelectedIndex = 2; } else { dpPastProcessDone.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["PastProcessStatusId"]).ToString()).Selected = true; } //try //{ // dpPastProcessDone.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["PastProcessStatusId"]).ToString()).Selected = true; //} //catch (InvalidCastException) //{ // dpPastProcessDone.SelectedIndex = 2; //} } }