protected void btnAddFinishGoodsdetail_Click(object sender, EventArgs e) { try { finishMdata = new MFinishedGoodsRelease(); finishBdata = new BFinishedGoodsRelease(); int Result = 0; finishMdata.FinishgoodId = 0; finishMdata.RMRId = string.IsNullOrEmpty(hId.Value) ? 0 : Convert.ToInt32(hId.Value); finishMdata.FinishedGoodsBatchCode = string.IsNullOrEmpty(txtBatchCode.Text) ? string.Empty : txtBatchCode.Text; finishMdata.FinishedGoodsDate = Convert.ToDateTime(txtDate.Text).ToString("dd-MM-yyyy"); finishMdata.FinishedGoodsShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); finishMdata.TypeofMilk = string.IsNullOrEmpty(txtMilkType.Text) ? string.Empty : txtMilkType.Text; finishMdata.FinishedGoodsQuantity = string.IsNullOrEmpty(txtQuantity.Text) ? string.Empty : txtQuantity.Text; finishMdata.FinishedGoodsMfgDate = Convert.ToDateTime(txtMfgDate.Text).ToString("dd-MM-yyyy"); finishMdata.FinishedGoodsStatusId = Convert.ToInt32(dpStatus.SelectedItem.Value); finishMdata.flag = "Insert"; Result = finishBdata.FinishedGoods(finishMdata); 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"); //GetFinishedGoodReleaseDetails(dates); RMRecieve R = new RMRecieve(); R.RMRDate = Convert.ToDateTime(txtDate.Text); GetFinishedGoodReleaseDetails(R); uprouteList.Update(); lblSuccess.Text = "Finished Goods Added Successfully"; pnlError.Update(); //ClearField(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } } catch (FormatException EX) { string MSG = EX.ToString(); } }
public void GetFinishedGoodReleaseDetails(int RMRId) { DataSet DS = new DataSet(); BFinishedGoodsRelease finishBdata = new BFinishedGoodsRelease(); DS = finishBdata.GetFinishedGoodReleaseDetailsById(RMRId); if (!Comman.Comman.IsDataSetEmpty(DS)) { txtBatchNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BatchNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BatchNo"].ToString(); txtMilkType.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(); string DATE = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["FinishedGoodsMfgDate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["FinishedGoodsMfgDate"].ToString(); //sky if (DATE == "") { txtMfgDate.Text = ""; } else { DateTime date1 = Convert.ToDateTime(DATE, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat); txtMfgDate.Text = (Convert.ToDateTime(date1).ToString("yyyy-MM-dd")); } txtBatchCode.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["FinishedGoodsBatchCode"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["FinishedGoodsBatchCode"].ToString(); dpStatus.ClearSelection(); try { if (dpStatus.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["StatusId"]).ToString()) != null) { dpStatus.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["StatusId"]).ToString()).Selected = true; } } catch (InvalidCastException) { dpStatus.SelectedIndex = 0; } dpShiftDetails.ClearSelection(); try { if (dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["FinishedGoodsShiftId"]).ToString()) != null) { dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["FinishedGoodsShiftId"]).ToString()).Selected = true; } } catch (InvalidCastException) { dpShiftDetails.SelectedIndex = 0; } } }
public void GetFinishedGoodReleaseDetails(RMRecieve R) { finishBdata = new BFinishedGoodsRelease(); DataSet DS = new DataSet(); DS = finishBdata.GetFinishedGoodReleaseDetails(R); if (!Comman.Comman.IsDataSetEmpty(DS)) { rpFinishGoodList.DataSource = DS; rpFinishGoodList.DataBind(); } else if (DS.Tables[0].Rows.Count == 0) { //this.BindRepeater(dt); rpFinishGoodList.DataSource = DS; rpFinishGoodList.DataBind(); } }
public void GetFinishedGoodReleaseDetails(string dates) { finishBdata = new BFinishedGoodsRelease(); DataSet DS = new DataSet(); DS = finishBdata.GetFinishedGoodReleaseDetails(dates); if (!Comman.Comman.IsDataSetEmpty(DS)) { rpFinishGoodList.DataSource = DS; rpFinishGoodList.DataBind(); } else { DS.Clear(); rpFinishGoodList.DataSource = DS; rpFinishGoodList.DataBind(); } }