public void Submit() { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); int TypeID = Convert.ToInt32(comboBox2.SelectedValue); int WireID = Convert.ToInt32(comboBox1.SelectedValue); int CatagoryID = Convert.ToInt32(comboBox3.SelectedValue); int UnitID = Convert.ToInt32(comboBox4.SelectedValue); int Visibilty = Convert.ToInt32(comboBox5.SelectedValue); var obj = db.tb_ParamName.FirstOrDefault(u => u.Type == TypeID && u.WireID == WireID && u.CatagoryID == CatagoryID && u.Name == txtParamName.Text && u.UnitID == UnitID && u.Enable == 1); if (obj == null) { tb_ParamName objParamName = new tb_ParamName(); objParamName.Name = txtParamName.Text; objParamName.Type = Convert.ToInt32(comboBox2.SelectedValue); objParamName.WireID = Convert.ToInt32(comboBox1.SelectedValue); objParamName.CatagoryID = Convert.ToInt32(comboBox3.SelectedValue); objParamName.UnitID = Convert.ToInt32(comboBox4.SelectedValue); objParamName.ShowParam = Visibilty; objParamName.Enable = 1; objParamName.Status = "Active"; objParamName.CreatedDate = DateTime.Now.Date; db.tb_ParamName.Add(objParamName); db.SaveChanges(); } else { MessageBox.Show("This Parameter Already Exists!"); } }
public void Delete(int ID) { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var DeleteData = db.tb_Product.FirstOrDefault(u => u.ID == ID); DeleteData.Status = "InActive"; db.SaveChanges(); }
//public void CreateFormulaString(string line) //{ // string InsideTxt = txtFormulaBar.Text; // InsideTxt += " "+line+" "; // txtFormulaBar.Text = InsideTxt; //} public void SubmitFormulaFor(int ID) { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var obj = db.tb_ParamName.FirstOrDefault(u => u.ID == ID); obj.Formula = Formula; db.SaveChanges(); }
public void Update(int ID) { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var updateData = db.tb_Degree.FirstOrDefault(u => u.ID == ID); updateData.Type = txtDegree.Text; updateData.CreatedDate = DateTime.Now.Date; db.SaveChanges(); }
private void repositoryItemButtonEdit1_ButtonPressed(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int Product_ID = Convert.ToInt32(gridView1.GetFocusedRowCellValue("ID")); WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var obj = db.tb_ParamList.FirstOrDefault(u => u.ID == Product_ID && u.Enable == 1); obj.Enable = 0; db.SaveChanges(); }
public void Update(int ID) { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var updateData = db.tb_Size.FirstOrDefault(u => u.ID == ID && u.Enable == 1); updateData.Size = txtSize.Text; updateData.CreatedDate = DateTime.Now.Date; db.SaveChanges(); }
private void repositoryItemButtonEdit1as_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int Wire_Id = Convert.ToInt32(gridView1.GetFocusedRowCellValue("ID")); WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var obj = db.tb_Wirename.FirstOrDefault(u => u.ID == Wire_Id && u.Enable == 1); obj.Enable = 0; db.SaveChanges(); BindGridview(); }
private void BtnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int ID = Convert.ToInt32(gridView1.GetFocusedRowCellValue("ID")); WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var obj = db.tb_Reports.FirstOrDefault(u => u.ID == ID); obj.Enable = 0; db.SaveChanges(); BindList(); }
public void Update(int ID) { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var updateData = db.tb_Product.FirstOrDefault(u => u.ID == ID && u.Enable == 1); updateData.WirenameID = Convert.ToInt32(comboBox1.SelectedValue); updateData.SizeID = Convert.ToInt32(comboBox3.SelectedValue); updateData.DegreeID = Convert.ToInt32(comboBox2.SelectedValue); updateData.Grade = Convert.ToInt32(comboBox6.SelectedValue); updateData.CreatedDate = DateTime.Now.Date; db.SaveChanges(); }
public void Update(int ID) { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var obj = db.tb_ParamList.FirstOrDefault(u => u.ID == ID && u.Enable == 1); if (obj != null) { obj.Name = txtListName.Text; obj.ParamTypeID = Convert.ToInt32(comboBox1.SelectedValue); } db.SaveChanges(); }
public void Submit() { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); tb_Size objsize = new tb_Size(); objsize.Size = txtSize.Text; objsize.CreatedDate = DateTime.Now.Date; objsize.CreateTime = DateTime.Now; objsize.Status = "Active"; objsize.Enable = 1; db.tb_Size.Add(objsize); db.SaveChanges(); }
public void Update(int ID) { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); tb_ParamName objParamName = db.tb_ParamName.FirstOrDefault(u => u.ID == ID && u.Enable == 1); objParamName.Name = txtParamName.Text; objParamName.Type = Convert.ToInt32(comboBox2.SelectedValue); objParamName.WireID = Convert.ToInt32(comboBox1.SelectedValue); objParamName.CatagoryID = Convert.ToInt32(comboBox3.SelectedValue); objParamName.UnitID = Convert.ToInt32(comboBox4.SelectedValue); objParamName.ShowParam = Convert.ToInt32(comboBox5.SelectedValue); db.SaveChanges(); }
public void Submit() { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); tb_ParamList objList = new tb_ParamList(); objList.Name = txtListName.Text; objList.ParamNameID = ID_PARAMNAME; objList.ParamTypeID = Convert.ToInt32(comboBox1.SelectedValue); objList.Status = "Active"; objList.Enable = 1; objList.CreatedDate = DateTime.Today; db.tb_ParamList.Add(objList); db.SaveChanges(); }
public void Submit() { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); tb_Product objProduct = new tb_Product(); objProduct.WirenameID = Convert.ToInt32(comboBox1.SelectedValue); objProduct.SizeID = Convert.ToInt32(comboBox3.SelectedValue); objProduct.DegreeID = Convert.ToInt32(comboBox2.SelectedValue); objProduct.Grade = Convert.ToInt32(comboBox6.SelectedValue); objProduct.CreatedDate = DateTime.Now.Date; objProduct.Enable = 1; objProduct.Status = "Active"; db.tb_Product.Add(objProduct); db.SaveChanges(); }
private void Btn_Delete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { Delete = Convert.ToInt32(gridView1.GetFocusedRowCellValue("Parameter_ID")); WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var DeleteData = db.tb_ParamName.FirstOrDefault(u => u.ID == Delete && u.Enable == 1); if (DeleteData.Status == "InActive") { DeleteData.Status = "Active"; } else { DeleteData.Status = "InActive"; } db.SaveChanges(); BindGrid(); }
private void repositoryItemButtonAction_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int product_ID = Convert.ToInt32(gridView1.GetFocusedRowCellValue("ID")); WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); var DeleteData = db.tb_Product.FirstOrDefault(u => u.ID == product_ID && u.Enable == 1); if (DeleteData.Status == "InActive") { DeleteData.Status = "Active"; } else { DeleteData.Status = "InActive"; } db.SaveChanges(); BindGridview(); }
public void Submit() { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); int RowIndex = 0; foreach (DataRow el in Dt_List.Rows) { if (el["Self_ID"].ToString() != "") { int self_Id = Convert.ToInt32(el["Self_ID"]); var obj = db.tb_ParamListValues.FirstOrDefault(u => u.ID == self_Id); if (IsTrueOrFalse == false) { obj.Val = Convert.ToString(el["Val"]); obj.Val2 = Convert.ToString(el["Val2"]); } else { if (gridView1.IsRowSelected(RowIndex)) { obj.Val = "true"; } else { obj.Val = "false"; } } obj.Tolerance = Convert.ToString(el["Tolerance"]); RowIndex++; } else { tb_ParamListValues objParamList = new tb_ParamListValues(); if (IsTrueOrFalse == false) { objParamList.Val = Convert.ToString(el["Val"]); objParamList.Val2 = Convert.ToString(el["Val2"]); } else { if (gridView1.IsRowSelected(RowIndex)) { objParamList.Val = "true"; } else { objParamList.Val = "false"; } } objParamList.ParamListID = Convert.ToInt32(el["ID"]); objParamList.Tolerance = Convert.ToString(el["Tolerance"]); objParamList.ParamNameID = Paramter_Name_ID; objParamList.CreatedDate = DateTime.Today; objParamList.Status = "Active"; db.tb_ParamListValues.Add(objParamList); RowIndex++; } } db.SaveChanges(); }
public void Submit() { WireTestSoftwareDBEntities db = new WireTestSoftwareDBEntities(); int ProductID = Convert.ToInt32(comboBox1.SelectedValue); tb_Reports obj = new tb_Reports(); db.tb_Reports.Add(obj); if (panel_Max.Visible == true) { foreach (DataRow elem in Dt_Max.Rows) { if (elem["ID"].ToString() != "") { int ID = Convert.ToInt32(elem["ID"]); var objMax_update = db.tb_ParamValue.FirstOrDefault(u => u.ProductID == ProductID && u.ID == ID); objMax_update.Val1 = (string)elem["Param_Max_Value"]; objMax_update.Tolerance = Convert.ToString(elem["Tolerance"]); } else { tb_ParamValue objParamVal = new tb_ParamValue(); string ParamName = (string)elem["Param_Max_Name"]; objParamVal.ParamNameID = db.tb_ParamName.FirstOrDefault(u => u.Name == ParamName).ID; objParamVal.ProductID = ProductID; objParamVal.Val1 = (string)elem["Param_Max_Value"]; objParamVal.Tolerance = Convert.ToString(elem["Tolerance"]); objParamVal.Status = "Active"; db.tb_ParamValue.Add(objParamVal); } } } if (panel_Min.Visible == true) { foreach (DataRow elem in Dt_Min.Rows) { if (elem["ID"].ToString() != "") { int ID = Convert.ToInt32(elem["ID"]); var objMax_update = db.tb_ParamValue.FirstOrDefault(u => u.ProductID == ProductID && u.ID == ID); objMax_update.Val1 = (string)elem["Param_Min_Value"]; objMax_update.Tolerance = Convert.ToString(elem["Tolerance"]); } else { tb_ParamValue objParamVal = new tb_ParamValue(); string ParamName = (string)elem["Param_Min_Name"]; objParamVal.ParamNameID = db.tb_ParamName.FirstOrDefault(u => u.Name == ParamName).ID; objParamVal.ProductID = ProductID; objParamVal.Val1 = (string)elem["Param_Min_Value"]; objParamVal.Tolerance = Convert.ToString(elem["Tolerance"]); objParamVal.Status = "Active"; db.tb_ParamValue.Add(objParamVal); } } } if (panel_Btw.Visible == true) { foreach (DataRow elem in Dt_btw.Rows) { if (elem["ID"].ToString() != "") { int ID = Convert.ToInt32(elem["ID"]); var objMax_update = db.tb_ParamValue.FirstOrDefault(u => u.ProductID == ProductID && u.ID == ID); objMax_update.Val1 = Convert.ToString(elem["Param_Btw_Value_From"]); objMax_update.Val2 = Convert.ToString(elem["Param_Btw_Value_To"]); objMax_update.Tolerance = Convert.ToString(elem["Tolerance"]); } else { tb_ParamValue objParamVal = new tb_ParamValue(); string ParamName = (string)elem["Param_Btw_Name"]; objParamVal.ParamNameID = db.tb_ParamName.FirstOrDefault(u => u.Name == ParamName).ID; objParamVal.ProductID = ProductID; objParamVal.Val1 = Convert.ToString(elem["Param_Btw_Value_From"]); objParamVal.Val2 = Convert.ToString(elem["Param_Btw_Value_To"]); objParamVal.Tolerance = Convert.ToString(elem["Tolerance"]); objParamVal.Status = "Active"; db.tb_ParamValue.Add(objParamVal); } } } if (panel_True_False.Visible == true) { int pvt_Cont = 0; int Rows = gridView4.RowCount; foreach (DataRow elem in Dt_TrueFalse.Rows) { if (elem["ID"].ToString() != "") { //Case Update... int Praram_ID = Convert.ToInt32(elem["ID"]); var obj_Update = db.tb_ParamValue.FirstOrDefault(u => u.ID == Praram_ID); obj_Update.Val1 = gridView4.IsRowSelected(pvt_Cont) == true ? "true" : "false"; } else { tb_ParamValue objParam = new tb_ParamValue(); objParam.Val1 = gridView4.IsRowSelected(pvt_Cont) == true ? "true" : "false"; objParam.ProductID = ProductID; objParam.Status = "Active"; string param_name = Convert.ToString(elem["Param_TrueFalse_Name"]); objParam.ParamNameID = db.tb_ParamName.FirstOrDefault(u => u.Name == param_name).ID; db.tb_ParamValue.Add(objParam); } pvt_Cont++; } } if (panel_Same_Value.Visible == true) { foreach (DataRow elem in Dt_SameValue.Rows) { if (elem["ID"].ToString() != "") { int ParamID = Convert.ToInt32(elem["ID"]); var obj_Update = db.tb_ParamValue.FirstOrDefault(u => u.ID == ParamID); string ParamName = (string)elem["Param_SameVal_Name"]; obj_Update.ParamNameID = db.tb_ParamName.FirstOrDefault(u => u.Name == ParamName).ID; obj_Update.Val1 = Convert.ToString(elem["Param_SameVal_Value"]); obj_Update.Tolerance = Convert.ToString(elem["Tolerance"]); } else { tb_ParamValue objParamVal = new tb_ParamValue(); string ParamName = Convert.ToString(elem["Param_SameVal_Name"]); objParamVal.ParamNameID = db.tb_ParamName.FirstOrDefault(u => u.Name == ParamName).ID; objParamVal.ProductID = Convert.ToInt32(comboBox1.SelectedValue); objParamVal.Val1 = Convert.ToString(elem["Param_SameVal_Value"]); objParamVal.Tolerance = Convert.ToString(elem["Tolerance"]); objParamVal.Status = "Active"; db.tb_ParamValue.Add(objParamVal); } } } db.SaveChanges(); }