public void GetProperties() { for (int i = 0; i < 6; i++) { string op = string.Format("OP{0}", i.ToString()); foreach (Control c in this.tableLayoutPanel1.Controls) { if ((c is ComboBox) && c.Name.ToUpper().Contains(op)) { ComboBox cb = (c as ComboBox); propertySet.GetProperty(op).Ctl = c; cb.ValueMember = "OPID"; cb.DisplayMember = "OPDESCR"; cb.SelectedValue = int.Parse(propertySet.GetProperty(op).Value); SwProperty p = this.propertySet.GetProperty(op); p.ID = (cb.SelectedItem as DataRowView).Row.ItemArray[0].ToString(); p.Value = (cb.SelectedItem as DataRowView).Row.ItemArray[1].ToString(); p.ResValue = (cb.SelectedItem as DataRowView).Row.ItemArray[2].ToString(); p.Table = "CUT_PARTS"; p.Field = string.Format("OP{0}ID", c.Name.Split('p')[1]); } } } }
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; }
/// <summary> /// This never really worked the way I hoped. /// </summary> /// <param name="propName">Prop name</param> /// <param name="Configuration">Configuration</param> /// <param name="oldValue">unused</param> /// <param name="NewValue">New Value</param> /// <param name="valueType">Type of value</param> /// <returns>0</returns> int dd_ChangeCustomPropertyNotify(string propName, string Configuration, string oldValue, string NewValue, int valueType) { SwProperty p = prop.GetProperty(propName); p.Value = NewValue; p.Type = (swCustomInfoType_e)valueType; //drb.DrbUpdate(); return(0); }
private void CalculateBlankSize(double edgeL, double edgeW) { double dVal = 0.0; double finLen = 0.0; double blankLen = 0.0; if (propertySet.Contains("LENGTH")) { if (double.TryParse(propertySet.GetProperty("LENGTH").ResValue, out finLen)) { blankLen = finLen; } if (double.TryParse(tbOverL.Text, out dVal)) { _overL = dVal; } this.tbBlankL.Text = Math.Round((blankLen + dVal + edgeW), 3).ToString("N3"); } blankLen = 0.0; if (propertySet.Contains("WIDTH")) { if (double.TryParse(propertySet.GetProperty("WIDTH").ResValue, out finLen)) { blankLen = finLen; } dVal = 0.0; if (double.TryParse(tbOverW.Text, out dVal)) { _overW = dVal; } tbBlankW.Text = Math.Round((blankLen + dVal + edgeL), 3).ToString("N3"); } }
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; }
private void LinkControls() { tbLength.Text = string.Empty; tbWidth.Text = string.Empty; tbThick.Text = string.Empty; tbWallThick.Text = string.Empty; tbComment.Text = string.Empty; propertySet.LinkControlToProperty("DESCRIPTION", true, tbDescription); propertySet.LinkControlToProperty("LENGTH", true, tbLength); propertySet.LinkControlToProperty("WIDTH", true, tbWidth); propertySet.LinkControlToProperty("THICKNESS", true, tbThick); propertySet.LinkControlToProperty("WALL THICKNESS", true, tbWallThick); propertySet.LinkControlToProperty("COMMENT", true, tbComment); UpdateRes(propertySet.GetProperty("LENGTH"), labResLength); UpdateRes(propertySet.GetProperty("WIDTH"), labResWidth); UpdateRes(propertySet.GetProperty("THICKNESS"), labResThickness); if (propertySet.GetProperty("WALL THICKNESS") != null) { UpdateRes(propertySet.GetProperty("WALL THICKNESS"), labResWallThickness); } UpdateLnW(); }