protected void btnAddRechilling_Click(object sender, EventArgs e) { RData = new MRechilling(); BData = new BRechilling(); int Result = 0; RData.RMRId = string.IsNullOrEmpty(hId.Value) ? 0 : Convert.ToInt32(hId.Value); foreach (RepeaterItem item in rpRechillingList.Items) { HiddenField hdfID2 = item.FindControl("hfQualityId") as HiddenField; if (hdfID2 != null) { RData.QualityId = string.IsNullOrEmpty(hdfID2.Value) ? 0 : Convert.ToInt32(hdfID2.Value); } } RData.BatchNo = string.IsNullOrEmpty(txtBatchNO.Text) ? string.Empty : txtBatchNO.Text; RData.ShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); RData.Date = Convert.ToDateTime(txtDate.Text.ToString()); RData.SiloNo = Convert.ToInt32(txtSiloNo.Text); RData.TypeOfMilk = dpTypeOfMilk.SelectedItem.Text; //string.IsNullOrEmpty(txtTypeOfMilk.Text) ? string.Empty : txtTypeOfMilk.Text; RData.Quantity = Convert.ToDouble(txtQuantity.Text); RData.IBTInTemperature = Convert.ToDouble(txtIBTInTemperature.Text); RData.IBTOutTemperature = Convert.ToDouble(txtIBTOutTemperature.Text); RData.MilkInTemperature = Convert.ToDouble(txtMilkInTemperature.Text); RData.MilkOutTemperature = Convert.ToDouble(txtMilkOutTemperature.Text); RData.RechilledBy = string.IsNullOrEmpty(txtRechilledBy.Text) ? string.Empty : txtRechilledBy.Text; RData.RechillStatusId = Convert.ToInt32(dpRechillStatus.SelectedItem.Value); RData.flag = "Insert"; Result = BData.RechillingData(RData); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "sel3", "$('#bx1').addClass('collapsed-box');", true); //string dates; //dates = string.IsNullOrEmpty(txtSearchDate.Text) ? string.Empty : Convert.ToDateTime(txtSearchDate.Text).ToString("dd-MM-yyyy"); //GetReachlingDetails(dates); RMRecieve R = new RMRecieve(); R.RMRDate = Convert.ToDateTime(txtDate.Text); GetReachlingDetails(R); uprouteList.Update(); lblSuccess.Text = "Rechilling Data Add Successfully"; pnlError.Update(); ClearTextbox(); } 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 GetRechillingDetails(int RMRId) { DataSet DS = new DataSet(); BRechilling BData = new BRechilling(); DS = BData.GetRechillingDataById(RMRId); if (!Comman.Comman.IsDataSetEmpty(DS)) { if (!Comman.Comman.IsDataSetEmpty(DS)) { string DATE = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["RMRDate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["RMRDate"].ToString(); DateTime date1 = Convert.ToDateTime(DATE, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat); txtDate.Text = (Convert.ToDateTime(date1).ToString("yyyy-MM-dd")); dpShiftDetails.ClearSelection(); string ShiftDetails = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["RMRShiftId"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["RMRShiftId"].ToString(); if (ShiftDetails == "") { dpShiftDetails.SelectedIndex = 0; } else { dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["RMRShiftId"]).ToString()).Selected = true; } //dpShiftDetails.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ShiftId"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ShiftId"].ToString(); txtBatchNO.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BatchNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BatchNo"].ToString(); txtSiloNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SiloNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["SiloNo"].ToString(); txtTypeOfMilk.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TypeOfMilk"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["TypeOfMilk"].ToString(); txtQuantity.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Qty"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Qty"].ToString(); txtIBTInTemperature.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["IBTInTemperature"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["IBTInTemperature"].ToString(); txtIBTOutTemperature.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["IBTOutTemperature"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["IBTOutTemperature"].ToString(); txtMilkInTemperature.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MilkInTemperature"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MilkInTemperature"].ToString(); txtMilkOutTemperature.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MilkOutTemperature"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MilkOutTemperature"].ToString(); txtRechilledBy.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["RechilledBy"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["RechilledBy"].ToString(); dpRechillStatus.ClearSelection(); string RechillStatus = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["RechillStatusId"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["RechillStatusId"].ToString(); if (RechillStatus == "") { dpRechillStatus.SelectedIndex = 0; } else { dpRechillStatus.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["RechillStatusId"]).ToString()).Selected = true; } } } }
protected void btnUpdate_Click(object sender, EventArgs e) { { MRechilling RData = new MRechilling(); BRechilling BData = new BRechilling(); int Result = 0; RData.RMRId = string.IsNullOrEmpty(hId.Value) ? 0 : Convert.ToInt32(hId.Value); RData.BatchNo = string.IsNullOrEmpty(txtBatchNO.Text) ? string.Empty : txtBatchNO.Text; RData.ShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); RData.Date = Convert.ToDateTime(txtDate.Text.ToString()); RData.SiloNo = Convert.ToInt32(txtSiloNo.Text); RData.TypeOfMilk = dpTypeOfMilk.SelectedItem.Text; //string.IsNullOrEmpty(txtTypeOfMilk.Text) ? string.Empty : txtTypeOfMilk.Text; RData.Quantity = Convert.ToDouble(txtQuantity.Text); RData.IBTInTemperature = Convert.ToDouble(txtIBTInTemperature.Text); RData.IBTOutTemperature = Convert.ToDouble(txtIBTOutTemperature.Text); RData.MilkInTemperature = Convert.ToDouble(txtMilkInTemperature.Text); RData.MilkOutTemperature = Convert.ToDouble(txtMilkOutTemperature.Text); RData.RechilledBy = string.IsNullOrEmpty(txtRechilledBy.Text) ? string.Empty : txtRechilledBy.Text; RData.RechillStatusId = Convert.ToInt32(dpRechillStatus.SelectedItem.Value); RData.flag = "Update"; Result = BData.RechillingData(RData); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "sel3", "$('#bx1').addClass('collapsed-box');", true); RMRecieve R = new RMRecieve(); R.RMRDate = Convert.ToDateTime(txtDate.Text); GetReachlingDetails(R); uprouteList.Update(); lblSuccess.Text = "Rechilling Data Updated Successfully"; pnlError.Update(); ClearTextbox(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } } }
public void GetReachlingDetails(string dates) { DataSet DS = new DataSet(); BRechilling BData = new BRechilling(); DS = BData.GetRechillingDetails(dates); if (!Comman.Comman.IsDataSetEmpty(DS)) { rpRechillingList.DataSource = DS; rpRechillingList.DataBind(); } else { DS.Clear(); rpRechillingList.DataSource = DS; rpRechillingList.DataBind(); } }
public void GetReachlingDetails(RMRecieve R) { DataSet DS = new DataSet(); BRechilling BData = new BRechilling(); DS = BData.GetRechillingDetails(R); if (!Comman.Comman.IsDataSetEmpty(DS)) { rpRechillingList.DataSource = DS; rpRechillingList.DataBind(); } else if (DS.Tables[0].Rows.Count == 0) { rpRechillingList.DataSource = DS; rpRechillingList.DataBind(); //this.BindRepeater(dt); } }