private void frmip_wo_Load(object sender, EventArgs e) { dgvwo.AutoGenerateColumns = false; dgvworm.AutoGenerateColumns = false; Hashtable htparam = new Hashtable(); htparam.Add("@atran_id", objBLFD.Tran_id.ToString()); htparam.Add("@atran_cd", objBLFD.Code); htparam.Add("@aptserial", ""); htparam.Add("@acompid", objBLFD.ObjCompany.Compid); htparam.Add("@atran_dt", objBLFD.HTMAIN["tran_dt"].ToString()); DataSet dsetWOwithBOM = objdblayer.dsprocedure("ISP_GET_IPWO_HEADER", htparam); if (dsetWOwithBOM != null && dsetWOwithBOM.Tables.Count != 0 && dsetWOwithBOM.Tables[0].Rows.Count != 0) { dgvwo.DataSource = dsetWOwithBOM.Tables[0]; dgvwo.Update(); int i = 0; foreach (DataRow row in dsetWOwithBOM.Tables[0].Rows) { foreach (DataGridViewColumn column in dgvwo.Columns) { if (dsetWOwithBOM.Tables[0].Columns.Contains(column.Name)) { dgvwo.Rows[i].Cells[column.Name].Value = row[column.Name]; } } i++; } } Bind_Item_Grid(); Get_Item_Details(); //if (ACTIVE_BL.Tran_mode != "add_mode") //{ // EditWOIP(); //} if (ACTIVE_BL.Tran_mode == "view_mode") { objHashtables.HashMaintbl.Clear(); objBLFD.HASHTABLES = objHashtables; EditWOIP(); dgvwo.Enabled = false; dgvworm.Enabled = false; btnDone.Enabled = false; } objHashtables = objBLFD.HASHTABLES; if (objHashtables != null && objHashtables.HashMaintbl != null && objHashtables.HashMaintbl.Count != 0) { if (_hashlocalipwomain != null) { _hashlocalipwomain.Clear(); } foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashMaintbl) { _hashlocalipwomain[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { ((Hashtable)_hashlocalipwomain[entry.Key])[entry1.Key] = entry1.Value; } } foreach (DataGridViewRow row in dgvwo.Rows) { foreach (DictionaryEntry entry in _hashlocalipwomain) { key = row.Cells["ref_tran_id"].Value.ToString() + "," + row.Cells["ref_ptserial"].Value.ToString() + "," + row.Cells["ref_prod_cd"].Value.ToString(); if (key == entry.Key.ToString().Split(',')[0] + "," + entry.Key.ToString().Split(',')[1] + "," + entry.Key.ToString().Split(',')[2]) { if (((Hashtable)entry.Value).Count != 0) { //row.Cells["issue_qty"].Value = (decimal.Parse(((Hashtable)entry.Value)["req_qty"].ToString()) * decimal.Parse(((Hashtable)entry.Value)["bom_qty"].ToString())) / decimal.Parse(((Hashtable)entry.Value)["rm_qty"].ToString()); row.Cells["sel"].Value = true; break; } } } } foreach (DataGridViewRow row in dgvworm.Rows) { foreach (DictionaryEntry entry in _hashlocalipwomain) { if (((Hashtable)entry.Value).Count != 0 && row.Cells["prod_cd"].Value.ToString() == entry.Key.ToString().Split(',')[3].ToString()) { foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { if (dgvworm.Columns.Contains(entry1.Key.ToString())) { row.Cells[entry1.Key.ToString()].Value = entry1.Value; } } } } } } else { objHashtables = new BLHT(); } AddThemesToTitleBar((Form)this, ucToolBar1, ACTIVE_BL, "CustomMaster"); ucToolBar1.Titlebar = "Work Order Details"; }
private void frmDispatchSchedule_Load(object sender, EventArgs e) { lblName.Text = "Product : " + _hashItemList["prod_nm"].ToString(); lblQty.Text = "Qty : " + _hashItemList["qty"].ToString(); dgvDispatchSchedule.AutoGenerateColumns = false; if (ACTIVE_BL.Tran_mode == "view_mode") { objHashtables.HashMaintbl.Clear(); objBLFD.HASHTABLES = objHashtables; dgvDispatchSchedule.Enabled = false; btnDone.Enabled = false; btnAdd.Enabled = false; btnRemove.Enabled = false; } #region objHashtables = objBLFD.HASHTABLES; #region 3.0 if (ACTIVE_BL.Tran_mode != "add_mode") { bool flg = true; if (objBLFD.HASHTABLES != null && objBLFD.HASHTABLES.HashMaintbl != null && objBLFD.HASHTABLES.HashMaintbl.Count != 0) { foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashMaintbl) { if (entry.Key.ToString().Split(',')[0].ToString() == _hashItemList["ptserial"].ToString()) { flg = false; break; } } } if (flg) { EditDSSchedule(); } } #endregion 3.0 if (objHashtables != null && objHashtables.HashMaintbl != null && objHashtables.HashMaintbl.Count != 0) { int i = 0; int j = 0; while (dgvDispatchSchedule.Rows.Count > 0) { if (!dgvDispatchSchedule.Rows[0].IsNewRow) { dgvDispatchSchedule.Rows.RemoveAt(0); } } if (_hashlocalDispatchSchedule != null) { _hashlocalDispatchSchedule.Clear(); } foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashMaintbl) { if (((Hashtable)entry.Value).Count != 0) { if (entry.Key.ToString().Split(',')[0].ToString() == _hashItemList["ptserial"].ToString()) { _hashlocalDispatchSchedule[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { ((Hashtable)_hashlocalDispatchSchedule[entry.Key])[entry1.Key] = entry1.Value; } } } } i = 0; foreach (DictionaryEntry entry in _hashlocalDispatchSchedule) { //i = i + 1; //key = _hashItemList["ptserial"].ToString() + "," + i; //if (_hashlocalDispatchSchedule.Contains(key)) //{ if (((Hashtable)entry.Value).Count != 0) { dgvDispatchSchedule.Rows.Add(1); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { if (dgvDispatchSchedule.Columns.Contains(entry1.Key.ToString())) { dgvDispatchSchedule.Rows[j].Cells[entry1.Key.ToString()].Value = entry1.Value.ToString(); } } j++; } //} } } else { objHashtables = new BLHT(); } #endregion AddThemesToTitleBar((Form)this, ucToolBar1, ACTIVE_BL, "CustomMaster"); ucToolBar1.Titlebar = "Schedule"; }
private void frmAdjustIssuetoReceipt_Load(object sender, EventArgs e) { if (this.Width > this.ClientSize.Width) { this.Width = this.ClientSize.Width; } if (ACTIVE_BL.Tran_mode == "view_mode") { objHashtables.HashIssueAndReceipt.Clear(); objBLFD.HASHTABLES = objHashtables; } dgvAdjustLI.AutoGenerateColumns = false; dgvAdjustLI.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; lblProd_nm.Text = "Product Name : " + _hashRowList["prod_nm"].ToString(); lblQty.Text = "Quantity : " + _hashRowList["qty"].ToString(); Hashtable htparam = new Hashtable(); htparam.Add("@atran_id", _hashRowList["tran_id"].ToString() != "0" ? objBLFD.Tran_id : _hashRowList["tran_id"].ToString()); htparam.Add("@atran_cd", _hashRowList["tran_id"].ToString() != "0" ? objBLFD.Code : ""); htparam.Add("@aptserial", _hashRowList["tran_id"].ToString() != "0" ? _hashRowList["ptserial"].ToString() : ""); htparam.Add("@aac_nm", objBLFD.HTMAIN["ac_nm"].ToString()); htparam.Add("@acompid", objBLFD.ObjCompany.Compid.ToString()); htparam.Add("@atran_dt", objBLFD.HTMAIN["TRAN_DT"].ToString()); DataSet dsetIssueAndReceipt = objdblayer.dsprocedure("ISP_GET_LABOURISSUE_FROM_LABOURRECEIPT", htparam); if (dsetIssueAndReceipt != null && dsetIssueAndReceipt.Tables.Count != 0 && dsetIssueAndReceipt.Tables[0].Rows.Count != 0) { dgvAdjustLI.DataSource = dsetIssueAndReceipt.Tables[0]; dgvAdjustLI.Update(); int i = 0; foreach (DataRow row in dsetIssueAndReceipt.Tables[0].Rows) { foreach (DataGridViewColumn column in dgvAdjustLI.Columns) { dgvAdjustLI.Rows[i].Cells[column.Name].Value = row[column.Name]; } i++; } } if (ACTIVE_BL.Tran_mode != "add_mode") { EditfrmAdjusttoReceipt(); } objHashtables = objBLFD.HASHTABLES; if (objHashtables != null && objHashtables.HashIssueAndReceipt != null && objHashtables.HashIssueAndReceipt.Count != 0) { decimal sumadjamt = 0, sumwastage = 0, cur_adj = 0, cur_wastage = 0, cons_qty = 0, avail_qty = 0; foreach (DataGridViewRow row in dgvAdjustLI.Rows) { sumadjamt = 0; sumwastage = 0; cur_adj = 0; cur_wastage = 0; cons_qty = 0; avail_qty = 0; foreach (DictionaryEntry entry in objHashtables.HashIssueAndReceipt) { string[] strKeys = entry.Key.ToString().Split(','); if (row.Cells["ref_tran_id"].Value.ToString() + "," + row.Cells["ref_ptserial"].Value.ToString() == strKeys[1] + "," + strKeys[2]) { if (_hashRowList["PTSERIAL"].ToString() == strKeys[0]) { cur_adj = decimal.Parse(((Hashtable)entry.Value)["adj_qty"].ToString()); cur_wastage = decimal.Parse(((Hashtable)entry.Value)["wastage"].ToString()); row.Cells["sel"].Value = bool.Parse(((Hashtable)entry.Value)["sel"].ToString()); } //else //{ sumadjamt += decimal.Parse(((Hashtable)entry.Value)["adj_qty"].ToString()); sumwastage += decimal.Parse(((Hashtable)entry.Value)["wastage"].ToString()); //} } } if (dsetIssueAndReceipt != null && dsetIssueAndReceipt.Tables.Count != 0 && dsetIssueAndReceipt.Tables[0].Rows.Count != 0) { DataRow[] row1 = dsetIssueAndReceipt.Tables[0].Select("ref_tran_id='" + row.Cells["ref_tran_id"].Value.ToString() + "' and ref_ptserial='" + row.Cells["ref_ptserial"].Value.ToString() + "'"); foreach (DataRow r in row1) { cons_qty = decimal.Parse(r["cons_qty"].ToString()); avail_qty = decimal.Parse(r["avail_qty"].ToString()); } } row.Cells["adj_qty"].Value = cur_adj; row.Cells["wastage"].Value = cur_wastage; row.Cells["cons_qty"].Value = cons_qty + (sumadjamt) + (sumwastage) - cur_adj - cur_wastage; row.Cells["avail_qty"].Value = decimal.Parse(row.Cells["qty"].Value.ToString()) - decimal.Parse(row.Cells["cons_qty"].Value.ToString());//avail_qty - sumadjamt - sumwastage + cur_adj + cur_wastage; } if (_hashlocalissuerecord != null) { _hashlocalissuerecord.Clear(); } foreach (DictionaryEntry entry in objHashtables.HashIssueAndReceipt) { if (_hashlocalissuerecord != null && !_hashlocalissuerecord.Contains(entry.Key)) { _hashlocalissuerecord[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); } foreach (DictionaryEntry entry1 in (Hashtable)entry.Value) { ((Hashtable)_hashlocalissuerecord[entry.Key]).Add(entry1.Key, entry1.Value); } //((Hashtable)_hashlocalissuerecord[entry.Key])["cons_qty"] = decimal.Parse(((Hashtable)_hashlocalissuerecord[entry.Key])["adj_qty"].ToString()) + decimal.Parse(((Hashtable)_hashlocalissuerecord[entry.Key])["wastage"].ToString()); } } else { objHashtables = new BLHT(); } if (ACTIVE_BL.Tran_mode == "view_mode") { dgvAdjustLI.ReadOnly = true; } AddThemesToTitleBar((Form)this, ucToolBar1, ACTIVE_BL, "CustomMaster"); ucToolBar1.Titlebar = "Labour Job Material Allocation"; }
private void frmAccountAlloc_Load(object sender, EventArgs e) { this.Bounds = new Rectangle(objBLFD.X_gridAccount, objBLFD.Y_gridAccount, objBLFD.Width_gridAccount, objBLFD.Hgt_gridAccount); if (this.Width > this.ClientSize.Width) { this.Width = this.ClientSize.Width; } if (ACTIVE_BL.Tran_mode == "view_mode") { objHashtables.HashAccountAlloc.Clear(); objBLFD.HASHTABLES = objHashtables; } dgvAccountAlloc.AutoGenerateColumns = false; dgvAccountAlloc.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; lblProd_nm.Text = "Account Name : " + objBLFD.HTMAIN["ac_nm"].ToString(); lblQty.Text = "Amount : " + _hashRowList["acc_amount"].ToString(); Hashtable htparam = new Hashtable(); htparam.Add("@atran_id", objBLFD.Tran_id); htparam.Add("@atran_cd", objBLFD.Code); htparam.Add("@aacserial", _hashRowList["acserial"].ToString()); htparam.Add("@aac_nm", objBLFD.HTMAIN["ac_nm"].ToString()); htparam.Add("@aposting_ac_nm", _hashRowList["acc_ac_nm"].ToString()); htparam.Add("@adate", objBLFD.HTMAIN["TRAN_DT"].ToString()); htparam.Add("@aacc_type", _hashRowList["acc_account_type"].ToString().Trim().ToUpper() == "CR" ? "DR" : "CR"); htparam.Add("@acompid", objBLFD.ObjCompany.Compid.ToString()); DataSet dsetAccountAlloc = objdblayer.dsprocedure("ISP_ALLOCATION", htparam); if (dsetAccountAlloc != null && dsetAccountAlloc.Tables.Count != 0 && dsetAccountAlloc.Tables[0].Rows.Count != 0) { dgvAccountAlloc.DataSource = dsetAccountAlloc.Tables[0]; dgvAccountAlloc.Update(); int i = 0; foreach (DataRow row in dsetAccountAlloc.Tables[0].Rows) { foreach (DataGridViewColumn column in dgvAccountAlloc.Columns) { if (dsetAccountAlloc.Tables[0].Columns.Contains(column.Name)) { dgvAccountAlloc.Rows[i].Cells[column.Name].Value = row[column.Name]; } } i++; } } if (ACTIVE_BL.Tran_mode != "add_mode") { EditfrmAdjusttoReceipt(); } objHashtables = objBLFD.HASHTABLES; #region 3.0 if (ACTIVE_BL.Tran_mode != "add_mode") { bool flg = true; if (objBLFD.HASHTABLES != null && objBLFD.HASHTABLES.HashAccountAlloc != null && objBLFD.HASHTABLES.HashAccountAlloc.Count != 0) { foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashAccountAlloc) { if (entry.Key.ToString().Split(',')[0].ToString() == _hashRowList["ACSERIAL"].ToString()) { flg = false; break; } } } if (flg) { EditfrmAdjusttoReceipt(); } } #endregion 3.0 if (objHashtables != null && objHashtables.HashAccountAlloc != null && objHashtables.HashAccountAlloc.Count != 0) { int j = 0; //while (dgvAccountAlloc.Rows.Count > 0) //{ // if (!dgvAccountAlloc.Rows[0].IsNewRow) // { // dgvAccountAlloc.Rows.RemoveAt(0); // } //} if (_hashlocalaccountalloc != null) { _hashlocalaccountalloc.Clear(); } foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashAccountAlloc) { if (((Hashtable)entry.Value).Count != 0) { if (entry.Key.ToString().Split(',')[0].ToString() == _hashRowList["ACSERIAL"].ToString()) { _hashlocalaccountalloc[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { ((Hashtable)_hashlocalaccountalloc[entry.Key])[entry1.Key] = entry1.Value; } } } } j = 0; foreach (DictionaryEntry entry in _hashlocalaccountalloc) { if (((Hashtable)entry.Value).Count != 0) { //dgvAccountAlloc.Rows.Add(); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { if (dgvAccountAlloc.Columns.Contains(entry1.Key.ToString())) { dgvAccountAlloc.Rows[j].Cells[entry1.Key.ToString()].Value = entry1.Value.ToString(); } } j++; } } } else { objHashtables = new BLHT(); } if (ACTIVE_BL.Tran_mode == "view_mode") { dgvAccountAlloc.ReadOnly = true; } AddThemesToTitleBar((Form)this, ucToolBar1, ACTIVE_BL, "CustomMaster"); ucToolBar1.Titlebar = "Account Allocation"; }
private void frmBOM_with_WorkOrder_Load(object sender, EventArgs e) { dgvBOM.AutoGenerateColumns = false; dgvRM_For_BOM.AutoGenerateColumns = false; if (ACTIVE_BL.Tran_mode == "view_mode") { objHashtables.HashMaintbl.Clear(); objHashtables.HashItemtbl.Clear(); objBLFD.HASHTABLES = objHashtables; } if (_hashItemList["tran_id"].ToString() == "0" || ACTIVE_BL.Tran_mode == "view_mode") { btnAdd.Visible = false; btnRemove.Visible = false; } Hashtable htparam = new Hashtable(); htparam.Add("@atran_id", _hashItemList["tran_id"].ToString() != "0" ? objBLFD.Tran_id : _hashItemList["tran_id"].ToString()); htparam.Add("@atran_cd", _hashItemList["tran_id"].ToString() != "0" ? objBLFD.Code : ""); htparam.Add("@aptserial", _hashItemList["ptserial"].ToString()); htparam.Add("@aprod_nm", _hashItemList["prod_nm"].ToString()); htparam.Add("@acompid", ACTIVE_BL.ObjCompany.Compid.ToString()); DataSet dsetWOwithBOM = objdblayer.dsprocedure("ISP_GET_WO_BO_DETAILS", htparam); if (dsetWOwithBOM != null && dsetWOwithBOM.Tables.Count != 0 && dsetWOwithBOM.Tables[0].Rows.Count != 0) { dgvBOM.DataSource = dsetWOwithBOM.Tables[0]; dgvBOM.Update(); int i = 0; foreach (DataRow row in dsetWOwithBOM.Tables[0].Rows) { foreach (DataGridViewColumn column in dgvBOM.Columns) { if (dsetWOwithBOM.Tables[0].Columns.Contains(column.Name)) { dgvBOM.Rows[i].Cells[column.Name].Value = row[column.Name]; } if (column.Name.ToLower() == "req_qty") { dgvBOM.Rows[i].Cells[column.Name].Value = _hashItemList["qty"].ToString(); } } i++; } } Bind_Item_Grid(); Get_Item_Details(); objHashtables = objBLFD.HASHTABLES; if (objHashtables != null && objHashtables.HashMaintbl != null && objHashtables.HashMaintbl.Count != 0) { if (_hashlocalwobomain != null) { _hashlocalwobomain.Clear(); } if (_hashlocalwoboitem != null) { _hashlocalwoboitem.Clear(); } foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashMaintbl) { if (entry.Key.ToString() == _hashItemList["ptserial"].ToString()) { _hashlocalwobomain[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { ((Hashtable)_hashlocalwobomain[entry.Key])[entry1.Key] = entry1.Value; } } } foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashItemtbl) { if (entry.Key.ToString().Split(',')[0] == _hashItemList["ptserial"].ToString()) { _hashlocalwoboitem[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { ((Hashtable)_hashlocalwoboitem[entry.Key])[entry1.Key] = entry1.Value; } } } #region foreach (DataGridViewRow row in dgvBOM.Rows) { foreach (DictionaryEntry entry in _hashlocalwobomain) { foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { if (dgvBOM.Columns.Contains(entry1.Key.ToString())) { row.Cells[entry1.Key.ToString()].Value = entry1.Value; } } } if (ACTIVE_BL.Tran_mode != "add_mode") { dgvBOM.Columns["sel"].ReadOnly = true; } } if (_hashlocalwoboitem.Count != 0) { while (dgvRM_For_BOM.Rows.Count > 0) { if (!dgvRM_For_BOM.Rows[0].IsNewRow) { dgvRM_For_BOM.Rows.RemoveAt(0); } } } //foreach (DictionaryEntry entry in _hashlocalwoboitem) //{ // if (((Hashtable)entry.Value).Count != 0)// && ((Hashtable)entry.Value)["woboitno"].ToString() == row.Cells["woboitno"].Value.ToString()) // { // dgvRM_For_BOM.Rows.Add(1); // foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) // { // if (dgvRM_For_BOM.Columns.Contains(entry1.Key.ToString())) // { // dgvRM_For_BOM.CurrentRow.Cells[entry1.Key.ToString()].Value = entry1.Value; // } // } // } //} int i = 0; foreach (DictionaryEntry entry in _hashlocalwoboitem) { if (((Hashtable)entry.Value).Count != 0)// && ((Hashtable)entry.Value)["woboitno"].ToString() == row.Cells["woboitno"].Value.ToString()) { dgvRM_For_BOM.Rows.Add(1); foreach (DataGridViewColumn column in dgvRM_For_BOM.Columns) { foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { if (dgvRM_For_BOM.Columns.Contains(entry1.Key.ToString())) { dgvRM_For_BOM.Rows[i].Cells[entry1.Key.ToString()].Value = entry1.Value; } } } dgvRM_For_BOM.Rows[i].Cells["rm_req_qty"].Value = ((decimal.Parse(dgvRM_For_BOM.Rows[i].Cells["rm_qty"].Value.ToString()) * decimal.Parse(dgvBOM.CurrentRow.Cells["req_qty"].Value.ToString())) / decimal.Parse(dgvBOM.CurrentRow.Cells["bom_qty"].Value.ToString())).ToString(); i++; } } #endregion } else { objHashtables = new BLHT(); } AddThemesToTitleBar((Form)this, ucToolBar1, ACTIVE_BL, "CustomMaster"); ucToolBar1.Titlebar = "WO With BOM"; }
public bool AmendementDetails() { bool _flgContinue = false; BL_BASEFIELD oldFileds = new BL_BASEFIELD();//(BL_BASEFIELD)ACTIVE_BL.Clone(); DataSet dsetview = objdblayer.dsquery("select top 1 * from " + ACTIVE_BL.Main_tbl_nm + " where tran_cd='" + ACTIVE_BL.Code + "' and " + ACTIVE_BL.Primary_id + "='" + ACTIVE_BL.HTMAIN[ACTIVE_BL.Primary_id].ToString() + "' and compid='" + ACTIVE_BL.ObjCompany.Compid.ToString() + "' order by " + ACTIVE_BL.Primary_id + " desc"); Hashtable HTITEMVal = ACTIVE_BL.HTMAIN; foreach (DictionaryEntry entry in HTITEMVal) { oldFileds.HTMAIN[entry.Key] = entry.Value; } if (dsetview != null && dsetview.Tables.Count != 0 && dsetview.Tables[0].Rows.Count != 0) { if (objBLFD.HTMAIN["IM_AMDNO"] != null && objBLFD.HTMAIN["IM_AMDNO"].ToString() != "" && objBLFD.HTMAIN["IM_AMDNO"].ToString() != dsetview.Tables[0].Rows[0]["IM_AMDNO"].ToString()) { _flgContinue = true; foreach (DataRow row in dsetview.Tables[0].Rows) { foreach (DataColumn column in dsetview.Tables[0].Columns) { if (oldFileds.HTMAIN.ContainsKey(column.ColumnName.Trim().ToUpper())) { if (column.DataType.Name.ToString().ToLower() == "datetime") { if (row[column.ColumnName] != null && row[column.ColumnName].ToString() != "") { oldFileds.HTMAIN[column.ColumnName.Trim().ToUpper()] = DateTime.Parse(row[column.ColumnName].ToString()).ToString("yyyy/MM/dd"); } else { oldFileds.HTMAIN[column.ColumnName.Trim().ToUpper()] = DateTime.Parse("01/01/1900"); } } else { oldFileds.HTMAIN[column.ColumnName.Trim().ToUpper()] = row[column.ColumnName].ToString().Trim(); } } } } } } if (_flgContinue && oldFileds.Item_tbl_nm != "") { dsetview.Clear(); dsetview = objdblayer.dsquery("select * from " + ACTIVE_BL.Item_tbl_nm + " where tran_cd='" + ACTIVE_BL.Code + "' and " + ACTIVE_BL.Primary_id + "='" + ACTIVE_BL.HTMAIN[ACTIVE_BL.Primary_id].ToString() + "' and compid='" + ACTIVE_BL.ObjCompany.Compid.ToString() + "' order by cast(ptserial as int)"); if (dsetview != null && dsetview.Tables.Count != 0 && dsetview.Tables[0].Rows.Count != 0) { foreach (DataRow row in dsetview.Tables[0].Rows) { oldFileds.HTITEM[row["PTSERIAL"].ToString().Trim()] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry in ACTIVE_BL.htitem_details) { ((Hashtable)oldFileds.HTITEM[row["PTSERIAL"].ToString().Trim()])[entry.Key] = entry.Value.ToString().Trim(); } foreach (DataColumn column in dsetview.Tables[0].Columns) { if (((Hashtable)oldFileds.HTITEM[row["PTSERIAL"].ToString().Trim()]).ContainsKey(column.ColumnName.Trim().ToUpper())) { if (column.DataType.Name.ToString().ToLower() == "datetime") { if (row[column.ColumnName] != null && row[column.ColumnName].ToString() != "") { ((Hashtable)oldFileds.HTITEM[row["PTSERIAL"].ToString().Trim()])[column.ColumnName.Trim().ToUpper()] = DateTime.Parse(row[column.ColumnName].ToString()).ToString("yyyy/MM/dd"); } else { ((Hashtable)oldFileds.HTITEM[row["PTSERIAL"].ToString().Trim()])[column.ColumnName.Trim().ToUpper()] = DateTime.Parse("01/01/1900"); } } else { ((Hashtable)oldFileds.HTITEM[row["PTSERIAL"].ToString().Trim()])[column.ColumnName.Trim().ToUpper()] = row[column.ColumnName].ToString().Trim(); } } } } } } if (_flgContinue && ACTIVE_BL != null && oldFileds != null) { try { if (objBLFD.HASHTABLES != null) { objhashtables = objBLFD.HASHTABLES; } else { objhashtables.HashGeneraltbl = new Hashtable(StringComparer.InvariantCultureIgnoreCase); } int k = 0; foreach (DictionaryEntry entry in ACTIVE_BL.HTMAIN) { if (oldFileds.HTMAIN.Contains(entry.Key) && ACTIVE_BL.HTMAIN[entry.Key].ToString() != oldFileds.HTMAIN[entry.Key].ToString()) { k++; objhashtables.HashGeneraltbl[k] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); ((Hashtable)objhashtables.HashGeneraltbl[k])["fld_nm"] = entry.Key; ((Hashtable)objhashtables.HashGeneraltbl[k])["old_value"] = oldFileds.HTMAIN[entry.Key].ToString(); ((Hashtable)objhashtables.HashGeneraltbl[k])["new_value"] = entry.Value.ToString(); ((Hashtable)objhashtables.HashGeneraltbl[k])["ptserial"] = ""; } } foreach (DictionaryEntry entry1 in ACTIVE_BL.HTITEM) { if (((Hashtable)ACTIVE_BL.HTITEM).Count != 0) { if (oldFileds.HTITEM.Contains(entry1.Key)) { foreach (DictionaryEntry entry in ((Hashtable)entry1.Value)) { if (((Hashtable)oldFileds.HTITEM[entry1.Key]).Contains(entry.Key.ToString()) && entry.Value.ToString() != ((Hashtable)oldFileds.HTITEM[entry1.Key])[entry.Key.ToString()].ToString()) { k++; objhashtables.HashGeneraltbl[k] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); ((Hashtable)objhashtables.HashGeneraltbl[k])["fld_nm"] = entry.Key; ((Hashtable)objhashtables.HashGeneraltbl[k])["old_value"] = ((Hashtable)oldFileds.HTITEM[entry1.Key])[entry.Key].ToString(); ((Hashtable)objhashtables.HashGeneraltbl[k])["new_value"] = entry.Value.ToString(); ((Hashtable)objhashtables.HashGeneraltbl[k])["ptserial"] = entry1.Key; } } } else { k++; objhashtables.HashGeneraltbl[k] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); ((Hashtable)objhashtables.HashGeneraltbl[k])["fld_nm"] = "ptserial"; ((Hashtable)objhashtables.HashGeneraltbl[k])["old_value"] = ""; ((Hashtable)objhashtables.HashGeneraltbl[k])["new_value"] = ""; ((Hashtable)objhashtables.HashGeneraltbl[k])["ptserial"] = entry1.Key; } } } objBLFD.HASHTABLES = objhashtables; } catch (Exception ex) { } } return(true); }
public bool DeleteTransactionItem() { bL_FIELDS.Errormsg = ""; if (ACTIVE_BL.Stk_effect == "+") { if (!StockCheck() && ACTIVE_BL.Tran_mode == "edit_mode") { return(false); } } if (ACTIVE_BL.Code == "LR") { objhashtables = ACTIVE_BL.HASHTABLES; if (objhashtables != null) { foreach (DictionaryEntry entry in objhashtables.HashIssueAndReceipt) { if (entry.Key.ToString().Split(',')[0] == _hashitemvalue["ptserial"].ToString()) { objhashtables.HashIssueAndReceipt.Remove(entry.Key); break; } } } objBLFD.HASHTABLES = objhashtables; } if (ACTIVE_BL.IsSchedule || ACTIVE_BL.Code == "PH" || ACTIVE_BL.Code == "PB" || ACTIVE_BL.Code == "DS") { objhashtables = ACTIVE_BL.HASHTABLES; if (objhashtables != null) { foreach (DictionaryEntry entry in objhashtables.HashMaintbl) { if (entry.Key.ToString().Split(',')[0] == _hashitemvalue["ptserial"].ToString()) { DataSet dsetDSSchedule = objdblayer.dsquery("select * from ide_schedule where ref_tran_id=" + objBLFD.Tran_id + " and ref_tran_cd='" + objBLFD.Code + "' and ref_ptserial='" + _hashitemvalue["ptserial"].ToString() + "'"); if (dsetDSSchedule != null && dsetDSSchedule.Tables.Count != 0 && dsetDSSchedule.Tables[0].Rows.Count != 0) { BL_FIELDS.Errormsg = "Sorry Scheduling Item Refered in De-Schedule"; return(false); } else { objhashtables.HashMaintbl.Remove(entry.Key); break; } } } } objBLFD.HASHTABLES = objhashtables; } if (ACTIVE_BL.IsDeSchedule) { objhashtables = ACTIVE_BL.HASHTABLES; if (objhashtables != null) { foreach (DictionaryEntry entry in objhashtables.HashDeallocateSchedule) { if (entry.Key.ToString().Split(',')[0] == _hashitemvalue["ptserial"].ToString()) { objhashtables.HashDeallocateSchedule.Remove(entry.Key); break; } } } objBLFD.HASHTABLES = objhashtables; } if (ACTIVE_BL.Code == "WO") { DataSet dsetpurref = objdblayer.dsquery("select count(*) cnt from IP_WO_DET where ref_tran_id='" + ACTIVE_BL.Tran_id + "' and ref_tran_cd='" + ACTIVE_BL.Code + "' and ref_ptserial='" + Hashitemvalue["PTSERIAL"].ToString() + "'"); if (dsetpurref != null && dsetpurref.Tables[0].Rows.Count != 0) { if (int.Parse(dsetpurref.Tables[0].Rows[0][0].ToString()) > 0) { BL_FIELDS.Errormsg = "Deleting this Work Order Item is not posible, Reason: Work Order Item used in Consumption"; return(false); } } } return(true); }
private void frmip_wo_Load(object sender, EventArgs e) { dgvopwo.AutoGenerateColumns = false; //Hashtable htparam = new Hashtable(); //htparam.Add("@atran_id", objBLFD.Tran_id.ToString()); //htparam.Add("@atran_cd", objBLFD.Code); //htparam.Add("@aptserial", ""); //htparam.Add("@atran_dt", objBLFD.HTMAIN["tran_dt"].ToString()); //htparam.Add("@acompid", objBLFD.ObjCompany.Compid); //DataSet dsetWOwithBOM = objdblayer.dsprocedure("ISP_GET_OPWO_HEADER", htparam); Hashtable htparam = new Hashtable(); htparam.Add("@atran_id", objBLFD.Tran_id.ToString()); htparam.Add("@atran_cd", objBLFD.Code != "" ? objBLFD.Code : ""); htparam.Add("@atran_dt", objBLFD.HTMAIN["tran_dt"].ToString()); htparam.Add("@acompid", objBLFD.ObjCompany.Compid); DataSet dsetWOwithBOM = objdblayer.dsprocedure("ISP_GET_OPWO_ITEM_SELECTED", htparam); if (dsetWOwithBOM != null && dsetWOwithBOM.Tables.Count != 0 && dsetWOwithBOM.Tables[0].Rows.Count != 0) { dgvopwo.DataSource = dsetWOwithBOM.Tables[0]; dgvopwo.Update(); int i = 0; foreach (DataRow row in dsetWOwithBOM.Tables[0].Rows) { foreach (DataGridViewColumn column in dgvopwo.Columns) { if (dsetWOwithBOM.Tables[0].Columns.Contains(column.Name)) { dgvopwo.Rows[i].Cells[column.Name].Value = row[column.Name]; } } i++; } } if (ACTIVE_BL.Tran_mode == "view_mode") { objHashtables.HashMaintbl.Clear(); objBLFD.HASHTABLES = objHashtables; dgvopwo.Enabled = false; btnDone.Enabled = false; } #region objHashtables = objBLFD.HASHTABLES; if (objHashtables != null && objHashtables.HashMaintbl != null && objHashtables.HashMaintbl.Count != 0) { if (_hashlocalipwomain != null) { _hashlocalipwomain.Clear(); } foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashMaintbl) { _hashlocalipwomain[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { ((Hashtable)_hashlocalipwomain[entry.Key])[entry1.Key] = entry1.Value; } } foreach (DataGridViewRow row in dgvopwo.Rows) { foreach (DictionaryEntry entry in _hashlocalipwomain) { key = row.Cells["ref_tran_id"].Value.ToString() + "," + row.Cells["ref_ptserial"].Value.ToString() + "," + row.Cells["ref_prod_cd"].Value.ToString(); if (key == entry.Key.ToString()) { if (((Hashtable)entry.Value).Count != 0) { foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { if (dgvopwo.Columns.Contains(entry1.Key.ToString())) { row.Cells[entry1.Key.ToString()].Value = entry1.Value.ToString(); } } row.Cells["sel"].Value = true; } } } } } else { objHashtables = new BLHT(); } #endregion AddThemesToTitleBar((Form)this, ucToolBar1, ACTIVE_BL, "CustomMaster"); ucToolBar1.Titlebar = "Work Order Details"; }
public void FinalUpdate() { if (objBLFD.IsFileAttach || objBLFD.Code == "EV") { #region string file_Path = "", file_nm = "", exist_file = ""; int _lastIndex = 0; //create floder if it is not existed. if (!System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + @"/" + objBLFD.ObjCompany.Db_nm + "/FILES")) { string pathString = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"" + objBLFD.ObjCompany.Db_nm, "FILES"); System.IO.Directory.CreateDirectory(pathString); } if (objBLFD.HASHTABLES != null && objBLFD.HASHTABLES.HashFileUpload != null && objBLFD.HASHTABLES.HashFileUpload.Count != 0) { Hashtable htFields = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Hashtable htFieldscond = new Hashtable(StringComparer.InvariantCultureIgnoreCase); bool bResult = false; string serialnos = "''", ptkey = "", removing_item = "", ptserial = "0"; foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashFileUpload) { if (((Hashtable)entry.Value).Count != 0) { file_Path = ((Hashtable)entry.Value)["file_path"].ToString(); _lastIndex = file_Path.LastIndexOf('\\') + 1; file_nm = objBLFD.Code + "_" + objBLFD.Tran_id + "_" + entry.Key.ToString() + "_" + file_Path.Substring(_lastIndex); if (serialnos == "''") { serialnos = "'" + ((Hashtable)entry.Value)["si_no"].ToString() + "'"; ptkey = "'" + entry.Key.ToString().Split(',')[0].ToString() + "'"; ptserial = entry.Key.ToString().Split(',')[0].ToString(); removing_item += "\"'" + file_nm + "'"; } else { serialnos += ",'" + ((Hashtable)entry.Value)["si_no"].ToString() + "'"; removing_item += "\"'" + file_nm + "'"; } if (entry.Key.ToString().Split(',')[0].ToString() != ptserial) { objdblayer.execDeleteQuery("delete from FILE_UPLOAD where si_no not in (" + serialnos + ") and ptserial in (" + ptkey + ") and tran_id='" + objBLFD.Tran_id + "' and tran_cd='" + objBLFD.Code + "'"); serialnos = "''"; } } else { ptkey = "'" + entry.Key.ToString().Split(',')[0].ToString() + "'"; ptserial = entry.Key.ToString().Split(',')[0].ToString(); } } objdblayer.execDeleteQuery("delete from FILE_UPLOAD where si_no not in (" + serialnos + ") and ptserial in (" + ptkey + ") and tran_id='" + objBLFD.Tran_id + "' and tran_cd='" + objBLFD.Code + "'"); foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashFileUpload) { if (((Hashtable)entry.Value).Count != 0) { // To avoid saving multiple Copies while edit exist_file = objBLFD.Code + "_" + objBLFD.Tran_id + "_" + entry.Key.ToString() + "_" + ((Hashtable)entry.Value)["file_nm"].ToString(); file_Path = ((Hashtable)entry.Value)["file_path"].ToString(); _lastIndex = file_Path.LastIndexOf('\\') + 1; file_nm = objBLFD.Code + "_" + objBLFD.Tran_id + "_" + entry.Key.ToString() + "_" + file_Path.Substring(_lastIndex); if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + objBLFD.ObjCompany.Db_nm + @"\FILES\" + exist_file)) { try { System.IO.File.Copy(file_Path, AppDomain.CurrentDomain.BaseDirectory + objBLFD.ObjCompany.Db_nm + @"\FILES\" + file_nm); } catch (Exception ex) { } ((Hashtable)entry.Value)["file_path"] = AppDomain.CurrentDomain.BaseDirectory + objBLFD.ObjCompany.Db_nm + @"\FILES\" + file_nm; } else { if (!(removing_item.Split('"').Contains(file_nm))) { System.IO.File.Delete(AppDomain.CurrentDomain.BaseDirectory + objBLFD.ObjCompany.Db_nm + @"\FILES\" + file_nm); } } foreach (DictionaryEntry entry1 in (Hashtable)entry.Value) { htFields.Add(entry1.Key, entry1.Value); } if (htFields.Count != 0) { if (htFields["fileId"] != null && htFields["fileId"].ToString() != "0") { htFieldscond["tran_id"] = objBLFD.Tran_id; htFieldscond["tran_cd"] = objBLFD.Code; htFieldscond["compid"] = objBLFD.ObjCompany.Compid.ToString(); htFieldscond["ptserial"] = entry.Key.ToString().Split(',')[0].ToString(); htFieldscond["fileId"] = htFields["fileId"].ToString(); htFields["fin_yr"] = objBLFD.ObjCompany.Fin_yr; htFields.Remove("fileId"); htFields.Remove("tran_id"); htFields.Remove("tran_cd"); htFields.Remove("ptserial"); htFields.Remove("compid"); bResult = objdblayer.execUpdate("FILE_UPLOAD", htFields, htFieldscond); } else { htFields["tran_id"] = objBLFD.Tran_id; htFields["tran_cd"] = objBLFD.Code; htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; htFields["compid"] = objBLFD.ObjCompany.Compid.ToString(); htFields["ptserial"] = entry.Key.ToString().Split(',')[0].ToString(); htFields["fin_yr"] = objBLFD.ObjCompany.Fin_yr; htFields.Remove("fileId"); bResult = objdblayer.execInsert("FILE_UPLOAD", htFields); } if (bResult) { htFields.Clear(); htFieldscond.Clear(); } } } } } #endregion } if (objBLFD.IsAmendment) { #region 2.0 if (objBLFD.HTMAIN.Contains("IM_AMDREQ") && objBLFD.HTMAIN["IM_AMDREQ"] != null && objBLFD.HTMAIN["IM_AMDREQ"].ToString() != "" && bool.Parse(objBLFD.HTMAIN["IM_AMDREQ"].ToString())) { if (objBLFD.HASHTABLES != null && objBLFD.HASHTABLES.HashGeneraltbl != null && objBLFD.HASHTABLES.HashGeneraltbl.Count != 0) { foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashGeneraltbl) { ((Hashtable)entry.Value)["tran_id"] = objBLFD.Tran_id; ((Hashtable)entry.Value)["tran_cd"] = objBLFD.Code; ((Hashtable)entry.Value)["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; ((Hashtable)entry.Value)["compid"] = objBLFD.ObjCompany.Compid; ((Hashtable)entry.Value)["fin_yr"] = objBLFD.ObjCompany.Fin_yr; ((Hashtable)entry.Value)["amd_no"] = objBLFD.HTMAIN["IM_AMDNO"]; ((Hashtable)entry.Value)["amd_dt"] = objBLFD.HTMAIN["IM_AMDDT"]; objdblayer.execInsert("TBL_AMD", ((Hashtable)entry.Value)); } } } #endregion 2.0 } if (ACTIVE_BL.Code == "LR") { #region objhashtables = ACTIVE_BL.HASHTABLES; Hashtable htFields = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Hashtable htFieldscond = new Hashtable(StringComparer.InvariantCultureIgnoreCase); bool bResult = false; foreach (DictionaryEntry entry in objhashtables.HashIssueAndReceipt) { foreach (DictionaryEntry entry1 in (Hashtable)entry.Value) { if (((Hashtable)entry.Value).Count == 0) { bool flg = DELETE_ITEM("ptserial", ((Hashtable)entry.Value)["ptserial"].ToString(), objBLFD.Tran_id, objBLFD.Code, "LR_LI_DET"); } else { htFields.Add(entry1.Key, entry1.Value); } } if (htFields.Count != 0) { if (htFields["tran_id"].ToString() != "0") { htFieldscond["ptserial"] = htFields["ptserial"]; htFieldscond["ref_tran_id"] = htFields["ref_tran_id"]; htFieldscond["ref_ptserial"] = htFields["ref_ptserial"]; htFieldscond["tran_id"] = objBLFD.Tran_id; htFieldscond["tran_cd"] = objBLFD.Code; htFields.Remove("ptserial"); htFields.Remove("ref_tran_id"); htFields.Remove("ref_ptserial"); htFields.Remove("tran_id"); htFields.Remove("tran_cd"); bResult = objdblayer.execUpdate("LR_LI_DET", htFields, htFieldscond); } else { htFields["tran_id"] = objBLFD.Tran_id; bResult = objdblayer.execInsert("LR_LI_DET", htFields); } if (bResult) { htFields.Clear(); htFieldscond.Clear(); } } } #endregion } if (ACTIVE_BL.IsSchedule) { #region 1.0 objhashtables = ACTIVE_BL.HASHTABLES; Hashtable htFields = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Hashtable htFieldscond = new Hashtable(StringComparer.InvariantCultureIgnoreCase); bool bResult = false; string serialnos = ""; foreach (DictionaryEntry entry in objhashtables.HashMaintbl) { if (((Hashtable)entry.Value).Count != 0) { if (serialnos == "") { serialnos = "'" + ((Hashtable)entry.Value)["schedule_id"].ToString() + "'"; } else { serialnos += ",'" + ((Hashtable)entry.Value)["schedule_id"].ToString() + "'"; } } } objdblayer.execDeleteQuery("delete from iSCHEDULE where schedule_id not in (" + serialnos + ") and tran_id='" + objBLFD.Tran_id + "' and tran_cd='" + objBLFD.Code + "'"); foreach (DictionaryEntry entry in objhashtables.HashMaintbl) { if (((Hashtable)entry.Value).Count != 0) { foreach (DictionaryEntry entry1 in (Hashtable)entry.Value) { htFields.Add(entry1.Key, entry1.Value); } if (htFields.Count != 0) { if (htFields["schedule_id"] != null && htFields["schedule_id"].ToString() != "0") { // htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; htFieldscond["schedule_id"] = htFields["schedule_id"]; htFieldscond["tran_id"] = objBLFD.Tran_id; htFieldscond["tran_cd"] = objBLFD.Code; htFieldscond["ptserial"] = htFields["ptserial"]; htFields.Remove("schedule_id"); htFields.Remove("tran_id"); htFields.Remove("tran_cd"); htFields.Remove("ptserial"); bResult = objdblayer.execUpdate("iSCHEDULE", htFields, htFieldscond); } else { htFields["tran_id"] = objBLFD.Tran_id; htFields["tran_cd"] = objBLFD.Code; // htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; htFields.Remove("schedule_id"); bResult = objdblayer.execInsert("iSCHEDULE", htFields); } if (bResult) { htFields.Clear(); htFieldscond.Clear(); } } } } #endregion 1.0 } if (ACTIVE_BL.IsDeSchedule) { #region 1.0 objhashtables = ACTIVE_BL.HASHTABLES; Hashtable htFields = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Hashtable htFieldscond = new Hashtable(StringComparer.InvariantCultureIgnoreCase); bool bResult = false; string serialnos = ""; foreach (DictionaryEntry entry in objhashtables.HashDeallocateSchedule) { if (((Hashtable)entry.Value).Count != 0) { if (serialnos == "") { serialnos = "'" + ((Hashtable)entry.Value)["de_schedule_id"].ToString() + "'"; } else { serialnos += ",'" + ((Hashtable)entry.Value)["de_schedule_id"].ToString() + "'"; } } } objdblayer.execDeleteQuery("delete from iDE_SCHEDULE where de_schedule_id not in (" + serialnos + ") and tran_id='" + objBLFD.Tran_id + "' and tran_cd='" + objBLFD.Code + "'"); foreach (DictionaryEntry entry in objhashtables.HashDeallocateSchedule) { if (((Hashtable)entry.Value).Count != 0) { foreach (DictionaryEntry entry1 in (Hashtable)entry.Value) { htFields.Add(entry1.Key, entry1.Value); } if (htFields.Count != 0) { if (htFields["de_schedule_id"] != null && htFields["de_schedule_id"].ToString() != "0") { // htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; htFieldscond["de_schedule_id"] = htFields["de_schedule_id"]; htFieldscond["tran_id"] = objBLFD.Tran_id; htFieldscond["tran_cd"] = objBLFD.Code; htFieldscond["ptserial"] = htFields["ptserial"]; htFields.Remove("de_schedule_id"); htFields.Remove("tran_id"); htFields.Remove("tran_cd"); htFields.Remove("ptserial"); bResult = objdblayer.execUpdate("iDE_SCHEDULE", htFields, htFieldscond); } else { htFields["tran_id"] = objBLFD.Tran_id; htFields["tran_cd"] = objBLFD.Code; // htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; htFields.Remove("de_schedule_id"); bResult = objdblayer.execInsert("iDE_SCHEDULE", htFields); } if (bResult) { htFields.Clear(); htFieldscond.Clear(); } } } } #endregion 1.0 } if (ACTIVE_BL.Code == "CE" || ACTIVE_BL.Code == "PP") { #region objhashtables = ACTIVE_BL.HASHTABLES; Hashtable htFields = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Hashtable htFieldscond = new Hashtable(StringComparer.InvariantCultureIgnoreCase); bool bResult = false; string serialnos = ""; foreach (DictionaryEntry entry in objhashtables.HashMaintbl) { if (((Hashtable)entry.Value).Count != 0) { if (serialnos == "") { serialnos += "'" + ((Hashtable)entry.Value)["ref_tran_id"].ToString() + "'"; } else { serialnos += ",'" + ((Hashtable)entry.Value)["ref_tran_id"].ToString() + "'"; } } } objdblayer.execDeleteQuery("delete from IP_WO_DET where ref_tran_id not in (" + serialnos + ") and tran_id='" + objBLFD.Tran_id + "' and tran_cd='" + objBLFD.Code + "'"); foreach (DictionaryEntry entry in objhashtables.HashMaintbl) { if (((Hashtable)entry.Value).Count != 0) { // bool flg = DELETE_ITEM("ref_tran_id", entry.Key.ToString().Split(',')[0], objBLFD.Tran_id, objBLFD.Code, "IP_WO_DET"); //} //else //{ foreach (DictionaryEntry entry1 in (Hashtable)entry.Value) { if (!(entry1.Key.ToString() == "ref_tran_id1" || entry1.Key.ToString() == "ref_ptserial1" || entry1.Key.ToString() == "ref_prod_cd1" || entry1.Key.ToString() == "ref_tran_no1")) { htFields.Add(entry1.Key, entry1.Value); } } if (htFields.Count != 0) { if (htFields["ip_wo_id"] != null && htFields["ip_wo_id"].ToString() != "0") { // htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; htFieldscond["ip_wo_id"] = htFields["ip_wo_id"]; htFieldscond["ref_tran_id"] = htFields["ref_tran_id"]; htFieldscond["ref_ptserial"] = htFields["ref_ptserial"]; htFieldscond["tran_id"] = objBLFD.Tran_id; htFieldscond["tran_cd"] = objBLFD.Code; htFields.Remove("ip_wo_id"); htFields.Remove("ref_tran_id"); htFields.Remove("ref_ptserial"); htFields.Remove("tran_id"); htFields.Remove("tran_cd"); bResult = objdblayer.execUpdate("IP_WO_DET", htFields, htFieldscond); } else { htFields["tran_id"] = objBLFD.Tran_id; htFields["tran_cd"] = objBLFD.Code; htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; htFields.Remove("ip_wo_id"); bResult = objdblayer.execInsert("IP_WO_DET", htFields); } if (bResult) { htFields.Clear(); htFieldscond.Clear(); } } } } #endregion } if (ACTIVE_BL.Code == "PD") { #region objhashtables = ACTIVE_BL.HASHTABLES; Hashtable htFields = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Hashtable htFieldscond = new Hashtable(StringComparer.InvariantCultureIgnoreCase); bool bResult = false; string serialnos = ""; foreach (DictionaryEntry entry in objhashtables.HashMaintbl) { if (((Hashtable)entry.Value).Count != 0) { if (serialnos == "") { serialnos += "'" + ((Hashtable)entry.Value)["ref_tran_id"].ToString() + "'"; } else { serialnos += ",'" + ((Hashtable)entry.Value)["ref_tran_id"].ToString() + "'"; } } } objdblayer.execDeleteQuery("delete from OP_WO_DET where ref_tran_id not in (" + serialnos + ") and tran_id='" + objBLFD.Tran_id + "'"); foreach (DictionaryEntry entry in objhashtables.HashMaintbl) { if (((Hashtable)entry.Value).Count != 0) { // bool flg = DELETE_ITEM("ref_tran_id", entry.Key.ToString().Split(',')[0], objBLFD.Tran_id, objBLFD.Code, "OP_WO_DET"); //} //else //{ foreach (DictionaryEntry entry1 in (Hashtable)entry.Value) { htFields.Add(entry1.Key, entry1.Value); } if (htFields.Count != 0) { if (htFields["op_wo_id"] != null && htFields["op_wo_id"].ToString() != "0") { // htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; // htFieldscond["op_wo_id"] = htFields["op_wo_id"]; htFieldscond["ref_tran_id"] = htFields["ref_tran_id"]; htFieldscond["ref_ptserial"] = htFields["ref_ptserial"]; htFieldscond["tran_id"] = objBLFD.Tran_id; htFieldscond["tran_cd"] = objBLFD.Code; htFields.Remove("op_wo_id"); htFields.Remove("ref_tran_id"); htFields.Remove("ref_ptserial"); htFields.Remove("tran_id"); htFields.Remove("tran_cd"); bResult = objdblayer.execUpdate("OP_WO_DET", htFields, htFieldscond); } else { htFields["tran_id"] = objBLFD.Tran_id; htFields["tran_cd"] = objBLFD.Code; htFields["tran_no"] = objBLFD.HTMAIN["TRAN_NO"]; htFields.Remove("op_wo_id"); bResult = objdblayer.execInsert("OP_WO_DET", htFields); } if (bResult) { htFields.Clear(); htFieldscond.Clear(); } } } } #endregion } if (ACTIVE_BL.Code == "WO") { objhashtables = ACTIVE_BL.HASHTABLES; Hashtable htFields = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Hashtable htFieldscond = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Save_Main_Trasaction(); } if (ACTIVE_BL.Code == "TS") { DataSet dsetBaseField = objdblayer.dsquery("select * from ibasefields where code='" + objBLFD.HTMAIN["Code"].ToString() + "'"); if (dsetBaseField != null && dsetBaseField.Tables.Count != 0 && dsetBaseField.Tables[0].Rows.Count != 0) { } else { string strQuery = "insert into ibasefields (code,[type],typewise,TRAN_CD,head_nm,order_no,col_order_no,fld_nm,data_ty,fld_wid,fld_desc,inter_val,mandatory,frm_nm,valid_mast,remarks,parent_ctrl,ctrl_not_show,_mul,reftbltran_cd,tbl_nm,sel_item,sel_val,_query,_querycon,_primddl,_Dpopflds,_top,_copy,when_con,valid_con,error_con,_mon_con,default_con,_read,_pickup,compid,_fld_width,_fld_pre)"; string strQueryVal = "select code='" + objBLFD.HTMAIN["Code"].ToString() + "',[type],typewise,TRAN_CD,head_nm,order_no,col_order_no,fld_nm,data_ty,fld_wid,fld_desc,inter_val,mandatory,frm_nm,valid_mast,remarks,parent_ctrl,ctrl_not_show,_mul,reftbltran_cd,tbl_nm,sel_item,sel_val,_query,_querycon,_primddl,_Dpopflds,_top,_copy,when_con,valid_con,error_con,_mon_con,default_con,_read,_pickup,compid,_fld_width,_fld_pre from ibasefields where code='" + objBLFD.HTMAIN["behavier_cd"].ToString() + "'"; objdblayer.execQuery(strQuery + strQueryVal); } } }
private void frmFileUpload_Load(object sender, EventArgs e) { dgvFileUpload.AutoGenerateColumns = false; if (_blnTypewise) { _local_ptserial = "0"; } else { _local_ptserial = _hashItemList["ptserial"].ToString(); } if (ACTIVE_BL.Tran_mode == "view_mode") { objHashtables.HashFileUpload.Clear(); objBLFD.HASHTABLES = objHashtables; // dgvFileUpload.Enabled = false; btnDone.Enabled = false; btnAdd.Enabled = false; btnRemove.Enabled = false; btnPreview.Enabled = true; } else { btnPreview.Enabled = false; } #region objHashtables = objBLFD.HASHTABLES; #region 3.0 if (ACTIVE_BL.Tran_mode != "add_mode") { bool flg = true; if (objBLFD.HASHTABLES != null && objBLFD.HASHTABLES.HashFileUpload != null && objBLFD.HASHTABLES.HashFileUpload.Count != 0) { foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashFileUpload) { if (entry.Key.ToString().Split(',')[0].ToString() == _local_ptserial) { flg = false; break; } } } if (flg) { if (objHashtables == null) { objHashtables = new BLHT(); } EditFileUpload(); } } #endregion 3.0 if (objHashtables != null && objHashtables.HashFileUpload != null && objHashtables.HashFileUpload.Count != 0) { int j = 0; while (dgvFileUpload.Rows.Count > 0) { if (!dgvFileUpload.Rows[0].IsNewRow) { dgvFileUpload.Rows.RemoveAt(0); } } if (_hashlocalFIleUpload != null) { _hashlocalFIleUpload.Clear(); } foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashFileUpload) { if (((Hashtable)entry.Value).Count != 0) { if (entry.Key.ToString().Split(',')[0].ToString() == _local_ptserial) { _hashlocalFIleUpload[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { ((Hashtable)_hashlocalFIleUpload[entry.Key])[entry1.Key] = entry1.Value; } } } } foreach (DictionaryEntry entry in _hashlocalFIleUpload) { if (((Hashtable)entry.Value).Count != 0) { dgvFileUpload.Rows.Add(1); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { if (dgvFileUpload.Columns.Contains(entry1.Key.ToString())) { dgvFileUpload.Rows[j].Cells[entry1.Key.ToString()].Value = entry1.Value.ToString(); } } j++; } } } else { objHashtables = new BLHT(); } #endregion AddThemesToTitleBar((Form)this, ucToolBar1, ACTIVE_BL, "CustomMaster"); ucToolBar1.Titlebar = "File Upload"; }
private void frmDeallocateSchedule_Load(object sender, EventArgs e) { lblName.Text = "Product : " + _hashItemList["prod_nm"].ToString(); lblQty.Text = "Qty : " + _hashItemList["qty"].ToString(); // _assigning_qty_value = _hashItemList["qty"] != null && _hashItemList["qty"].ToString() != "" ? decimal.Parse(_hashItemList["qty"].ToString()) : decimal.Parse("0.00"); dgvDeallocateSchedule.AutoGenerateColumns = false; if (objBLFD.HTMAINREF != null && objBLFD.HTMAINREF.Count != 0 && ((Hashtable)objBLFD.HTMAINREF[_hashItemList["ptserial"]]) != null && ((Hashtable)objBLFD.HTMAINREF[_hashItemList["ptserial"]]).Count != 0) { Hashtable htparam = new Hashtable(); htparam.Add("@aref_tran_id", ((Hashtable)objBLFD.HTMAINREF[_hashItemList["ptserial"]])["ref_tran_id"].ToString()); htparam.Add("@aref_tran_cd", ((Hashtable)objBLFD.HTMAINREF[_hashItemList["ptserial"]])["ref_tran_cd"].ToString()); htparam.Add("@aref_ptserial", ((Hashtable)objBLFD.HTMAINREF[_hashItemList["ptserial"]])["ref_ptserial"].ToString()); htparam.Add("@atran_id", objBLFD.Tran_id.ToString()); htparam.Add("@atran_cd", objBLFD.Code != "" ? objBLFD.Code : ""); htparam.Add("@aptserial", _hashItemList["ptserial"].ToString()); htparam.Add("@acompid", objBLFD.ObjCompany.Compid.ToString()); dsetDSSchedule = objdblayer.dsprocedure("ISP_DISPATCH_QTY", htparam); if (dsetDSSchedule != null && dsetDSSchedule.Tables.Count != 0 && dsetDSSchedule.Tables[0].Rows.Count != 0) { dgvDeallocateSchedule.DataSource = dsetDSSchedule.Tables[0]; dgvDeallocateSchedule.Update(); int i = 0; foreach (DataRow row in dsetDSSchedule.Tables[0].Rows) { foreach (DataGridViewColumn column in dgvDeallocateSchedule.Columns) { if (dsetDSSchedule.Tables[0].Columns.Contains(column.Name)) { dgvDeallocateSchedule.Rows[i].Cells[column.Name].Value = row[column.Name]; } } i++; } } if (ACTIVE_BL.Tran_mode == "view_mode") { objHashtables.HashDeallocateSchedule.Clear(); objBLFD.HASHTABLES = objHashtables; dgvDeallocateSchedule.Enabled = false; btnDone.Enabled = false; } if (ACTIVE_BL.Tran_mode != "add_mode") { bool flg = true; if (objBLFD.HASHTABLES != null && objBLFD.HASHTABLES.HashDeallocateSchedule != null && objBLFD.HASHTABLES.HashDeallocateSchedule.Count != 0) { foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashDeallocateSchedule) { if (entry.Key.ToString().Split(',')[0].ToString() == _hashItemList["ptserial"].ToString()) { flg = false; break; } } } if (flg) { EditDSSchedule(); } } #region objHashtables = objBLFD.HASHTABLES; if (objHashtables != null && objHashtables.HashDeallocateSchedule != null && objHashtables.HashDeallocateSchedule.Count != 0) { if (_hashlocalDispatchSchedule != null) { _hashlocalDispatchSchedule.Clear(); } foreach (DictionaryEntry entry in objBLFD.HASHTABLES.HashDeallocateSchedule) { if (((Hashtable)entry.Value).Count != 0) { if (entry.Key.ToString().Split(',')[0].ToString() == _hashItemList["ptserial"].ToString()) { _hashlocalDispatchSchedule[entry.Key] = new Hashtable(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { ((Hashtable)_hashlocalDispatchSchedule[entry.Key])[entry1.Key] = entry1.Value; } } } } foreach (DataGridViewRow row in dgvDeallocateSchedule.Rows) { foreach (DictionaryEntry entry in _hashlocalDispatchSchedule) { key = _hashItemList["ptserial"].ToString() + "," + row.Cells["schedule_no"].Value.ToString(); if (((Hashtable)entry.Value).Count != 0 && key == entry.Key.ToString()) { if (((Hashtable)entry.Value).Count != 0) { foreach (DictionaryEntry entry1 in ((Hashtable)entry.Value)) { if (dgvDeallocateSchedule.Columns.Contains(entry1.Key.ToString())) { row.Cells[entry1.Key.ToString()].Value = entry1.Value.ToString(); } } row.Cells["sel"].Value = true; } } } } } else { objHashtables = new BLHT(); } #endregion } else { dgvDeallocateSchedule.Enabled = false; btnDone.Enabled = false; } AddThemesToTitleBar((Form)this, ucToolBar1, ACTIVE_BL, "CustomMaster"); ucToolBar1.Titlebar = "De-Allocate Schedule"; this.StartPosition = FormStartPosition.CenterScreen; }