public void Update(ref SwProperties p) { propertySet = p; OpType = p.cutlistData.OpType; RefreshOps(OpType); LinkControls(); }
public Ops(ref SwProperties prop) { cd = prop.cutlistData; propertySet = prop; InitializeComponent(); }
public void Update(ref SwProperties p) { dirtTracker.Besmirched -= dirtTracker_Besmirched; //if (ch.CutlistComboBox.SelectedItem != null && ch.RevComboBox.Text != string.Empty) { // Properties.Settings.Default.CurrentCutlist = int.Parse((ch.CutlistComboBox.SelectedItem as DataRowView)[0].ToString()); // Properties.Settings.Default.CurrentRev = int.Parse(ch.RevComboBox.Text); // Properties.Settings.Default.Save(); //} TearDownDeptSelectEvent(); // Order matters here. The first thing SwProperties does informs what ds // does. Ds informs these other guys. props = p; ds.Update(ref p); cs.Update(ref p); gbSpecProp.Text = p.PartName + " - " + p.configName; gp.Update(ref p); op.Update(ref p); mp.Update(ref p, cs.EdgeDiffL, cs.EdgeDiffW); //ch.Update(ref p); if (props.PartFileInfo != null) { int hash = Redbrick.GetHash(string.Format("{0}\\{1}", props.PartFileInfo.Directory.FullName, props.PartFileInfo.Name)); if (int.Parse(props.GetProperty("CRC32").Value) != hash) { props.GetProperty("CRC32").Value = hash.ToString(); } } SetupDeptSelectEvent(); IsDirty = false; dirtTracker.Besmirched += dirtTracker_Besmirched; }
public DepartmentSelector(ref SwProperties p) { PropertySet = p; SwApp = p.SwApp; InitializeComponent(); Init(); }
public void Update(ref SwProperties p) { PropertySet = p; LinkControlToProperty(); PropertySet.cutlistData.OpType = OpType; cbDepartment.SelectedValue = OpType; starting_index = cbDepartment.SelectedIndex; }
public ConfigurationSpecific(ref SwProperties prop) { propertySet = prop; cd = prop.cutlistData; _edgeDiffL = 0.0; _edgeDiffW = 0.0; InitializeComponent(); init(); }
/// <summary> /// Update fields with data from the SwProperties we receive. /// </summary> /// <param name="prop">An SwProperties object.</param> public void Update(ref SwProperties prop) { propertySet = prop; configurationName = prop.modeldoc.ConfigurationManager.ActiveConfiguration.Name; cd = prop.cutlistData; Updte(); Redbrick.unselect(Controls); Redbrick.unselect(tableLayoutPanel1.Controls); }
/// <summary> /// After this object is created and some variables defined, we fire things up. /// </summary> public void Start() { SwApp = RequestSW(); prop = new SwProperties(_swApp); SwApp.ActiveDocChangeNotify += SwApp_ActiveDocChangeNotify; SwApp.DestroyNotify += SwApp_DestroyNotify; SwApp.FileCloseNotify += SwApp_FileCloseNotify; SwApp.CommandCloseNotify += SwApp_CommandCloseNotify; Document = SwApp.ActiveDoc; ConnectSelection(); }
public ModelRedbrick(ref SwProperties p) { props = p; _swApp = p.SwApp; p.frm = this.ParentForm; InitializeComponent(); // MS init Init(); // my additional init dirtTracker = new DirtTracker(this); dirtTracker.Besmirched += dirtTracker_Besmirched; IsDirty = false; s = gp.Size; }
public MachineProgramManager(SwProperties p, string searchterm) { InitializeComponent(); prop = p; cutlistData = p.cutlistData; string s = OnlyDigits(searchterm); dtP1 = cutlistData.GetMachinesByProg(s, 1); dtP2 = cutlistData.GetMachinesByProg(s, 2); dtP3 = cutlistData.GetMachinesByProg(s, 3); wubp = cutlistData.GetWhereUsedByProg(s); gpbc = cutlistData.GetPartsByCNC(s); init(); }
public void Update(ref SwProperties p) { propertySet = p; LinkControls(); ToggleFields(propertySet.cutlistData.OpType); if (Properties.Settings.Default.MakeSounds) { try { sp.LoadAsync(); } catch (Exception ex) { propertySet.SwApp.SendMsgToUser2(ex.Message, (int)swMessageBoxIcon_e.swMbStop, (int)swMessageBoxBtn_e.swMbOk); } } }
public void Update(ref SwProperties p, double l, double w) { propertySet = p; LinkControls(); ToggleFields(this.propertySet.cutlistData.OpType); if (tbCNC1.Text.Trim() == "NA" || tbCNC1.Text.Trim() == string.Empty) { btnWhere.Enabled = false; } else { btnWhere.Enabled = true; } CalculateBlankSize(l, w); }
public GeneralProperties(ref SwProperties prop) { propertySet = prop; InitializeComponent(); AutoCompleteStringCollection skdim = new AutoCompleteStringCollection(); for (int i = 0; i < Properties.Settings.Default.SketchDimensions.Count; i++) { skdim.Add(Properties.Settings.Default.SketchDimensions[i]); } tbLength.AutoCompleteSource = AutoCompleteSource.CustomSource; tbLength.AutoCompleteCustomSource = skdim; tbWidth.AutoCompleteSource = AutoCompleteSource.CustomSource; tbWidth.AutoCompleteCustomSource = skdim; tbThick.AutoCompleteSource = AutoCompleteSource.CustomSource; tbThick.AutoCompleteCustomSource = skdim; tbWallThick.AutoCompleteSource = AutoCompleteSource.CustomSource; tbWallThick.AutoCompleteCustomSource = skdim; }
public void Update(ref SwProperties p) { propertySet = p; LinkControls(); ToggleFields(this.propertySet.cutlistData.OpType); }
public MachineProperties(ref SwProperties prop) { propertySet = prop; InitializeComponent(); }
public int RemovePart(SwProperties part) { int affected = 0; int partid = GetPartID(part.PartName); if (ENABLE_DB_WRITE && (GetHash(part.PartName) == part.Hash)) { string SQL = "DELETE FROM CUT_PARTS WHERE PARTNUM = ?"; using (OdbcCommand comm = new OdbcCommand(SQL, conn)) { comm.Parameters.AddWithValue("@part", part.PartName); affected = comm.ExecuteNonQuery(); } } return affected; }
public static Part MakePartFromPropertySet(SwProperties swp, ushort q) { Part p = new Part(); p.SetQuantity(q.ToString()); p.FileInformation = swp.PartFileInfo; p.PartNumber = swp.PartName; p.SetMaterialID(swp.GetProperty("MATID").ID); p.SetEdgeFrontID(swp.GetProperty("EFID").ID); p.SetEdgeBackID(swp.GetProperty("EBID").ID); p.SetEdgeLeftID(swp.GetProperty("ELID").ID); p.SetEdgeRightID(swp.GetProperty("ERID").ID); p.Description = swp.GetProperty("Description").Value; p.SetLength(swp.GetProperty("LENGTH").ResValue); p.SetWidth(swp.GetProperty("WIDTH").ResValue); p.SetThickness(swp.GetProperty("THICKNESS").ResValue); p.Comment = swp.GetProperty("COMMENT").Value; p.CNC1 = swp.GetProperty("CNC1").Value; p.CNC2 = swp.GetProperty("CNC2").Value; p.SetUpdateCNC((swp.GetProperty("UPDATE CNC").Ctl as System.Windows.Forms.CheckBox).Checked ? "True" : "False"); p.SetOverL(swp.GetProperty("OVERL").Value); p.SetOverW(swp.GetProperty("OVERW").Value); p.SetBlankQty(swp.GetProperty("BLANK QTY").Value); p.SetDeptID(swp.GetProperty("DEPTID").ID); p.SetOpID(swp.GetProperty("OP1ID").ID, 0); p.SetOpID(swp.GetProperty("OP2ID").ID, 1); p.SetOpID(swp.GetProperty("OP3ID").ID, 2); p.SetOpID(swp.GetProperty("OP4ID").ID, 3); p.SetOpID(swp.GetProperty("OP5ID").ID, 4); int tp = 0; int.TryParse(swp.GetProperty("CRC32").Value, out tp); string hash = string.Format("{0:X}", tp); p.Hash = uint.Parse(hash, System.Globalization.NumberStyles.HexNumber); return p; }
public int UpdateParts(SwProperties p, int clid) { int rowsAffected = 0; if (ENABLE_DB_WRITE) { string SQL = @"UPDATE CUT_PARTS SET DESCR = ?, FIN_L = ?, FIN_W = ?, THICKNESS = ?, CNC1 = ?, CNC2 = ?, " + "BLANKQTY = ?, OVER_L = ?, OVER_W = ?, OP1ID = ?, OP2ID = ?, OP3ID = ?, OP4ID = ?, OP5ID = ?, COMMENT = ?, " + "UPDATE_CNC = ?, TYPE = ? WHERE PARTNUM = ? AND HASH = ?"; using (OdbcCommand comm = new OdbcCommand(SQL, conn)) { string dscr = p.GetProperty("Description").Value.Replace("'", "\""); double finL = 0.0f; parse(p.GetProperty("LENGTH").ResValue, out finL); double finW = 0.0f; parse(p.GetProperty("WIDTH").ResValue, out finW); double thkn = 0.0f; parse(p.GetProperty("THICKNESS").ResValue, out thkn); double ovrL = 0.0f; parse(p.GetProperty("OVERL").Value, out ovrL); double ovrW = 0.0f; parse(p.GetProperty("OVERW").Value, out ovrW); string cnc1 = p.GetProperty("CNC1").Value.Replace("'", "\""); string cnc2 = p.GetProperty("CNC2").Value.Replace("'", "\""); string blnk = p.GetProperty("BLANK QTY").Value.Replace("'", "\""); string cmnt = p.GetProperty("COMMENT").Value.Replace("'", "\""); string updt = p.GetProperty("UPDATE CNC").ID.Replace("'", "\""); int Op1 = 0; parse(p.GetProperty("OP1ID").ID, out Op1); int Op2 = 0; parse(p.GetProperty("OP2ID").ID, out Op2); int Op3 = 0; parse(p.GetProperty("OP3ID").ID, out Op3); int Op4 = 0; parse(p.GetProperty("OP4ID").ID, out Op4); int Op5 = 0; parse(p.GetProperty("OP5ID").ID, out Op5); comm.Parameters.AddWithValue("@descr", dscr); comm.Parameters.AddWithValue("@finl", finL); comm.Parameters.AddWithValue("@finw", finW); comm.Parameters.AddWithValue("@thkn", thkn); comm.Parameters.AddWithValue("@cnc1", cnc1); comm.Parameters.AddWithValue("@cnc2", cnc2); comm.Parameters.AddWithValue("@blnk", blnk); comm.Parameters.AddWithValue("@ovrL", ovrL); comm.Parameters.AddWithValue("@ovrW", ovrW); comm.Parameters.AddWithValue("@op1", Op1); comm.Parameters.AddWithValue("@op2", Op2); comm.Parameters.AddWithValue("@op3", Op3); comm.Parameters.AddWithValue("@op4", Op4); comm.Parameters.AddWithValue("@op5", Op5); comm.Parameters.AddWithValue("@comment", cmnt); comm.Parameters.AddWithValue("@updtCnc", (updt == "1")); comm.Parameters.AddWithValue("@opType", OpType); comm.Parameters.AddWithValue("@prtName", p.PartName); comm.Parameters.AddWithValue("@hash", p.Hash); try { comm.ExecuteNonQuery(); } catch (InvalidOperationException ioe) { throw ioe; } } } return rowsAffected; }
public int ReturnHash(SwProperties p) { if (p.PartName == string.Empty) return 0; string SQL = @"SELECT CUT_PARTS.HASH FROM CUT_PARTS WHERE (((CUT_PARTS.PARTNUM)=?))"; using (OdbcCommand comm = new OdbcCommand(SQL, conn)) { comm.Parameters.AddWithValue("@partnum", p.PartName); using (OdbcDataReader dr = comm.ExecuteReader()) { if (dr.Read() && !dr.IsDBNull(0)) return dr.GetInt32(0); else return 0; } } }
public int MakeOriginal(SwProperties p) { int rowsAffected = 0; if (ENABLE_DB_WRITE) { string SQL = @"UPDATE CUT_PARTS SET CUT_PARTS.HASH = ? WHERE (((CUT_PARTS.PARTNUM)=?));"; using (OdbcCommand comm = new OdbcCommand(SQL, conn)) { comm.Parameters.AddWithValue("@hash", p.Hash); comm.Parameters.AddWithValue("@partNo", p.PartName); try { rowsAffected = comm.ExecuteNonQuery(); } catch (InvalidOperationException ioe) { throw ioe; } } } return rowsAffected; }
public void Update(ref SwProperties p, double l, double w) { propertySet = p; LinkControls(); ToggleFields(this.propertySet.cutlistData.OpType); if (tbCNC1.Text.Trim() == "NA" || tbCNC1.Text.Trim() == string.Empty) btnWhere.Enabled = false; else btnWhere.Enabled = true; CalculateBlankSize(l, w); }
//private System.Media.SoundPlayer sp = new System.Media.SoundPlayer(Properties.Settings.Default.ClipboardSound); public MachineProperties(ref SwProperties prop) { propertySet = prop; InitializeComponent(); }
/// <summary> /// Remove a part from a cutlist. /// </summary> /// <param name="clid">Cutlist ID integer.</param> /// <param name="p">Property set.</param> /// <returns></returns> public int RemovePartFromCutlist(int clid, SwProperties p) { int affected = 0; int partid = GetPartID(p.PartName); if (ENABLE_DB_WRITE && (GetHash(p.PartName) == p.Hash)) { string SQL = "DELETE FROM CUT_CUTLIST_PARTS WHERE CLID = ? AND PARTID = ?"; using (OdbcCommand comm = new OdbcCommand(SQL, conn)) { comm.Parameters.AddWithValue("@clid", clid); comm.Parameters.AddWithValue("@partid", partid); affected = comm.ExecuteNonQuery(); if (affected > 0 && !PartUsed(p.PartName)) { RemovePart(p); } } } return affected; }
public bool PartUsed(SwProperties part) { string SQL = @"SELECT CUT_CUTLIST_PARTS.*, CUT_PARTS.PARTID, CUT_PARTS.PARTNUM " + @"FROM CUT_CUTLIST_PARTS INNER JOIN CUT_PARTS ON CUT_CUTLIST_PARTS.PARTID = CUT_PARTS.PARTID " + @"WHERE (((CUT_PARTS.PARTNUM)= ?))"; using (OdbcCommand comm = new OdbcCommand(SQL, conn)) { comm.Parameters.AddWithValue("@Part", part.PartName); using (OdbcDataAdapter da = new OdbcDataAdapter(comm)) { using (DataSet ds = new DataSet()) { da.Fill(ds); return ds.Tables[0].Rows.Count > 0; } } } }