public bool RemoveProduction(int id) { methodName = "RemoveProduction"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; production oDBProduction = uow.Production.SingleOrDefault(m => m.Id == id); if (oDBProduction != null) { traceID = 3; uow.Production.Remove(id); uow.Save(); } traceID = 5; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(true); }
/*-----------------------------------------------------------*/ /*--- Constructor(s) ----------------------------------------*/ /*-----------------------------------------------------------*/ /** Full constructor. * @param prod production this item uses. * @param pos position of the "dot" within the item. */ public lr_item_core(production prod, int pos) { production_part part; if (prod == null) { throw new internal_error( "Attempt to create an lr_item_core with a null production"); } _the_production = prod; if (pos < 0 || pos > _the_production.rhs_length()) { throw new internal_error( "Attempt to create an lr_item_core with a bad dot position"); } _dot_pos = pos; /* compute and cache hash code now */ _core_hash_cache = 13 * _the_production.GetHashCode() + pos; /* cache the symbol after the dot */ if (_dot_pos < _the_production.rhs_length()) { part = _the_production.rhs(_dot_pos); if (!part.is_action()) { _symbol_after_dot = ((symbol_part)part).the_symbol(); } } }
public bool EditProduction(production oData) { methodName = "EditProduction"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.Production.Get(oData.Id); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.Production.Update(oDBData); uow.Save(); traceID = 4; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
/*-----------------------------------------------------------*/ /*--- Constructor(s) ----------------------------------------*/ /*-----------------------------------------------------------*/ /** Full constructor. * @param prod production this item uses. * @param pos position of the "dot" within the item. */ public lr_item_core(production prod, int pos) { production_part part; if (prod == null) throw new internal_error( "Attempt to create an lr_item_core with a null production"); _the_production = prod; if (pos < 0 || pos > _the_production.rhs_length()) throw new internal_error( "Attempt to create an lr_item_core with a bad dot position"); _dot_pos = pos; /* compute and cache hash code now */ _core_hash_cache = 13*_the_production.GetHashCode() + pos; /* cache the symbol after the dot */ if (_dot_pos < _the_production.rhs_length()) { part = _the_production.rhs(_dot_pos); if (!part.is_action()) _symbol_after_dot = ((symbol_part)part).the_symbol(); } }
public int AddProduction(production oData) { methodName = "AddProduction"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { using (var trans = uow.BeginTransaction()) { try { traceID = 2; production oNewProduction = new production(); oNewProduction.MapFrom(oData); oNewProduction = uow.Production.Add(oNewProduction); uow.Save(); traceID = 3; oData.Id = oNewProduction.Id; trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } return(oData.Id); }
/*-----------------------------------------------------------*/ /*--- Constructor(s) ----------------------------------------*/ /*-----------------------------------------------------------*/ /** Simple constructor. * @param prod the production this action reduces with. */ public reduce_action(production prod ) { /* sanity check */ if (prod == null) throw new internal_error( "Attempt to create a reduce_action with a null production"); _reduce_with = prod; }
/** Constructor. * @param base the production we are being factored out of. * @param lhs_sym the LHS symbol for this production. * @param rhs_parts array of production parts for the RHS. * @param rhs_len how much of the rhs_parts array is valid. * @param action_str the trailing reduce action for this production. */ public action_production( production cbase, non_terminal lhs_sym, production_part[] rhs_parts, int rhs_len, string action_str) : base(lhs_sym, rhs_parts, rhs_len, action_str) { _base_production = cbase; }
/*-----------------------------------------------------------*/ /*--- Constructor(s) ----------------------------------------*/ /*-----------------------------------------------------------*/ /** Simple constructor. * @param prod the production this action reduces with. */ public reduce_action(production prod) { /* sanity check */ if (prod == null) { throw new internal_error( "Attempt to create a reduce_action with a null production"); } _reduce_with = prod; }
static ArrayList addOpts(ArrayList prods, Hashtable nts) { ArrayList L = new ArrayList(); foreach (production p in prods) { L.Add(p); } foreach (production p in prods) { foreach (string s in p.rule) { if (s.EndsWith("opt") && !nts.Contains(s)) { string basename = s.Substring(0, s.LastIndexOf("opt")); production q; string ty; if (nts.Contains(basename)) { ty = ((typeInfo)nts[basename]).ty; string action = ((typeInfo)nts[basename]).action; q = new production(s, new string[] {}, ty, action); L.Add(q); q = new production(s, new string[] { basename }, ty, "a1"); L.Add(q); nts[s] = new typeInfo(ty, ""); } else { ty = "InputElement"; q = new production(s, new string[] {}, ty, "null"); L.Add(q); q = new production(s, new string[] { basename }, ty, "a1"); L.Add(q); } nts[s] = new typeInfo(ty, ""); } } } return(L); }
static ArrayList process(Excel.Workbook wb, ArrayList prods) { foreach (Excel.Worksheet ws in wb.Sheets) { if (ws.Name.EndsWith("grammar")) { Excel.Range nonterms = ws.get_Range("grammar_Nonterminal", missing); Excel.Range rules = ws.get_Range("grammar_Rule", missing); Excel.Range types = ws.get_Range("grammar_type", missing); Excel.Range actions = ws.get_Range("grammar_Action", missing); for (int i = 1; i <= ws.UsedRange.Rows.Count; i++) { string nt = item(nonterms, i); string rule = item(rules, i); string ty = item(types, i); string action = item(actions, i); if (action == "") { if (rule == "") { action = "null"; } else { action = "a1"; } } if (nt != "") { string[] rx = rule.Trim(' ').Split(' '); production p = new production(nt, rx, ty, action); prods.Add(p); } } } } return(prods); }
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ /** Constructor for dot at start of right hand side. * @param prod production this item uses. */ public lr_item_core(production prod) : this(prod,0) { //this(prod,0); }
public bool EditProductioninput(ListOrderProduction oData, production oDatas) { methodName = "EditProductioninput"; traceID = 1; using (var uow = new UnitOfWork(AppConfig.Current.ContextName)) { traceID = 2; var oDBData = uow.ListOrderProduction.Get(oData.Id); if (oDBData != null) { using (var trans = uow.BeginTransaction()) { try { traceID = 3; oDBData.MapFrom(oData); uow.ListOrderProduction.Update(oDBData); traceID = 4; OrderProductioninput oDBListorderjual = uow.OrderProductioninput.SingleOrDefault(m => m.IdOrderProduction == oData.IdOrder); if (oDBListorderjual != null) { traceID = 5; oDBListorderjual.MapFrom(oData); traceID = 6; uow.OrderProductioninput.Update(oDBListorderjual); } else { traceID = 7; OrderProductioninput oNewListorderjual = new OrderProductioninput(); oNewListorderjual.MapFrom(oData); traceID = 8; uow.OrderProductioninput.Add(oNewListorderjual); } traceID = 9; OrderProductioncustom oDBListorderjual1 = uow.OrderProductioncustom.SingleOrDefault(m => m.IdOrderProductionCustom == oData.IdOrder); if (oDBListorderjual1 != null) { traceID = 10; oDBListorderjual1.MapFrom(oData); traceID = 11; uow.OrderProductioncustom.Update(oDBListorderjual1); } else { traceID = 12; traceID = 13; } traceID = 14; uow.Save(); trans.Commit(); } catch (Exception ex) { trans.Rollback(); throw new AppException(500, methodName, traceID, ex); } } } } return(true); }
private void SaveProduction_Click(object sender, RoutedEventArgs e) { if (txtProductionNumber.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } ProductionBLL productionBLL = new ProductionBLL(); ProductionBLL ProductionBLL = new ProductionBLL(); production production = new production(); production.IdKodeTransaksi = 28; if (this.dokumenSelected != null) { production.IdDocumentReference = this.dokumenSelected.Id; production.DokumenReference = this.dokumenSelected.NoReferensiDokumen; } production.Tanggal = DateTime.Parse(tanggal.Text); if (this.lokasiSelected != null) { production.IdLokasi = this.lokasiSelected.Id; production.Location = this.lokasiSelected.NamaTempatLokasi; } if (this.kontakSelected != null) { production.IdKontak = this.kontakSelected.Id; production.NamaPetugas = this.kontakSelected.NamaA; } production.Note = txtNote.Text; production.ProductionNumber = double.Parse(txtProductionNumber.Text); production.TotalDebitAkunPersediaanProduk = double.Parse(txtTotal.Text); production.TotalKreditAkunPersediaanProduk = double.Parse(txtTotalinput.Text); if (this.dataDepartemenSelected != null) { production.IdDepartmen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { production.IdProyek = this.dataProyekSelected.Id; } if (ProductionBLL.AddProduction(production) > 0) { // this.ClearForm(); MessageBox.Show("Productions successfully added !"); } else { MessageBox.Show("Productions failed to add !"); } if (DGSKUProduction.Items.Count > 0) { foreach (var item in DGSKUProduction.Items) { if (item is ListOrderProduction) { ListOrderProduction oNewData1 = (ListOrderProduction)item; if (this.lokasiSelected != null) { oNewData1.IdLokasi = this.lokasiSelected.Id; oNewData1.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } oNewData1.Tanggal = DateTime.Parse(tanggal.Text); oNewData1.CheckboxAktif = false; oNewData1.IdTransaksi = production.Id; if (this.dataDepartemenSelected != null) { oNewData1.IdDepartemen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { oNewData1.IdProyek = this.dataProyekSelected.Id; } if (productionBLL.EditProductioninput(oNewData1, production) == true) { } } } } if (DGSKUFinishedProduction.Items.Count > 0) { foreach (var item in DGSKUFinishedProduction.Items) { if (item is OrderFinishedproduk) { OrderFinishedproduk oNewData1 = (OrderFinishedproduk)item; if (this.lokasiSelected != null) { oNewData1.IdLokasi = this.lokasiSelected.Id; oNewData1.NamaLokasi = this.lokasiSelected.NamaTempatLokasi; } oNewData1.Tanggal = DateTime.Parse(tanggal.Text); oNewData1.CheckboxAktif = false; if (this.dataDepartemenSelected != null) { oNewData1.IdDepartemen = this.dataDepartemenSelected.Id; } if (this.dataProyekSelected != null) { oNewData1.IdProyek = this.dataProyekSelected.Id; } if (productionBLL.EditFinishedproduk(oNewData1, production) == true) { } } } Production v = new Production(); Switcher.SwitchNewProduction(v); } }
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ /** Constructor for dot at start of right hand side. * @param prod production this item uses. */ public lr_item_core(production prod) : this(prod, 0) { //this(prod,0); }
CheckArguments(production, sales, storageInfo);
private void simpan_color() { //simpan color production k = new production(); dtColor.EndEdit(); for (int i = 0; i < dtColor.Rows.Count - 1; i++) { if (Convert.ToString(dtColor.Rows[i].Cells["hJONO"].Value) == "") { //insert k.JONO = txtJONO.Text; k.STYLEID = txtStyleID.Text; k.COLORID = Convert.ToString(dtColor.Rows[i].Cells["hColorID"].Value); if (cek.date(dtColor.Rows[i].Cells["hDelivery"].Value)) { k.DELIVERYDATE = Convert.ToDateTime(dtColor.Rows[i].Cells["hDelivery"].Value, new CultureInfo(GlobalVariables.GCulture)); } else { k.DELIVERYDATE = null; } if (cek.date(dtColor.Rows[i].Cells["hStart"].Value)) { k.STARTDATE = Convert.ToDateTime(dtColor.Rows[i].Cells["hStart"].Value, new CultureInfo(GlobalVariables.GCulture)); } else { k.STARTDATE = null; } if (cek.date(dtColor.Rows[i].Cells["hClose"].Value)) { k.CLOSEDATE = Convert.ToDateTime(dtColor.Rows[i].Cells["hClose"].Value, new CultureInfo(GlobalVariables.GCulture)); } else { k.CLOSEDATE = null; } //k.WASHING = ""; if (new productionCRUD().insertData(k)) { } else { MessageBox.Show("gagal bro"); } } else //update { k.JONO = Convert.ToString(dtColor.Rows[i].Cells["hJONO"].Value);; k.STYLEID = Convert.ToString(dtColor.Rows[i].Cells["hStyleID"].Value); k.COLORID = Convert.ToString(dtColor.Rows[i].Cells["hColorID"].Value); if (cek.date(dtColor.Rows[i].Cells["hDelivery"].Value)) { k.DELIVERYDATE = Convert.ToDateTime(dtColor.Rows[i].Cells["hDelivery"].Value, new CultureInfo(GlobalVariables.GCulture)); } else { k.DELIVERYDATE = null; } if (cek.date(dtColor.Rows[i].Cells["hStart"].Value)) { k.STARTDATE = Convert.ToDateTime(dtColor.Rows[i].Cells["hStart"].Value, new CultureInfo(GlobalVariables.GCulture)); } else { k.STARTDATE = null; } if (cek.date(dtColor.Rows[i].Cells["hClose"].Value)) { k.CLOSEDATE = Convert.ToDateTime(dtColor.Rows[i].Cells["hClose"].Value, new CultureInfo(GlobalVariables.GCulture)); } else { k.CLOSEDATE = null; } if (new productionCRUD().updateData(k, k.JONO, k.STYLEID, k.COLORID)) { } else { MessageBox.Show("gagal bro"); } } } }