private void tbgoodid_Leave(object sender, EventArgs e) { if (isEdit == true && tbgoodid.Text.Trim() != "") { string[] IDS = tbgoodid.Text.Trim().Split('.'); if (IDS.Length > 0) { tb_ColorInfoMethod colorMethod = new tb_ColorInfoMethod(); tb_ColorInfo color = colorMethod.Find(IDS[0]); if (!string.IsNullOrEmpty(color.strColorNo)) { cmbColor.SelectedValue = color.strColorNo; cmbColor.Text = color.strColorName; if (IDS.Length > 1) { tb_ModelInfoMethod modelmethod = new tb_ModelInfoMethod(); tb_ModelInfo model = modelmethod.FindByID(IDS[1]); if (!string.IsNullOrEmpty(model.strModelNo)) { tbgoodname.SelectedValue = model.strModelNo; tbgoodname.Text = model.strModelName; tbmono.Text = model.strModelNo; tbftypestep1.SelectedValue = model.strFTypeSteps1 == null ? "" : model.strFTypeSteps1; tbftypestep2.SelectedValue = model.strFTypeSteps2 == null ? "" : model.strFTypeSteps2; tbftypestep3.SelectedValue = model.strFTypeSteps3 == null ? "" : model.strFTypeSteps3; tbmqty.Text = model.strFMaterialQty; } } } } } }
private void tbmodelno_Leave(object sender, EventArgs e) { tb_ModelInfo model = new tb_ModelInfo(); tb_ModelInfoMethod modeMethod = new tb_ModelInfoMethod(); if (tbgoodname.Enabled) { if (tbgoodname.Text != "") { model = modeMethod.Find(tbgoodname.Text); tbmono.Text = model.strModelNo; tbftypestep1.SelectedValue = model.strFTypeSteps1 == null ? "" : model.strFTypeSteps1; tbftypestep2.SelectedValue = model.strFTypeSteps2 == null ? "" : model.strFTypeSteps2; tbftypestep3.SelectedValue = model.strFTypeSteps3 == null ? "" : model.strFTypeSteps3; //tbfcolorsteps.SelectedValue = model.str pictureBox1.ImageLocation = model.strFImagePath; tbmqty.Text = model.strFMaterialQty; } else { //tbModelNo1.Text = ""; tbftypestep1.Text = ""; tbftypestep2.Text = ""; tbftypestep3.Text = ""; pictureBox1.ImageLocation = ""; tbmqty.Text = ""; } } }
public int tb_ModelUpdate(tb_ModelInfo good, string modelno) { int intFalg = 0; try { string str_Update = "update tb_ModelInfo set "; str_Update += "ModelNo='" + good.strModelNo + "', "; str_Update += "ModelName='" + good.strModelName + "',"; str_Update += "FModifier='" + good.strFModifier + "',"; str_Update += "FModifydate= '" + good.dFModifydate + "',FImagePath ='" + good.strFImagePath + "',"; str_Update += "FTypeSteps1='" + good.strFTypeSteps1 + "',FTypeSteps2 ='" + good.strFTypeSteps2 + "',"; str_Update += "FTypeSteps3= '" + good.strFTypeSteps3 + "',FIsStop =" + good.iFIsStop + " ,FMaterialQty= '" + good.strFMaterialQty + "'"; str_Update += " where ModelNo='" + modelno + "'"; intFalg = dbc.ExeInfochange(str_Update); return(intFalg); // conn.Dispose(); //return intFalg; } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
public tb_ModelInfo FindByID(string _modelId) { tb_ModelInfo goods = new tb_ModelInfo(); string sql = "select ModelNo,ModelName,FTypeSteps1,FTypeSteps2,FTypeSteps3,FImagePath,FMaterialQty from tb_ModelInfo where ModelNo ='" + _modelId + "' and FIsStop = 0"; DataSet ds = dbl.GetDataset(sql); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { goods.strModelNo = ds.Tables[0].Rows[i][0].ToString(); goods.strModelName = ds.Tables[0].Rows[i][1].ToString(); goods.strFTypeSteps1 = ds.Tables[0].Rows[i][2].ToString(); goods.strFTypeSteps2 = ds.Tables[0].Rows[i][3].ToString(); goods.strFTypeSteps3 = ds.Tables[0].Rows[i][4].ToString(); goods.strFImagePath = ds.Tables[0].Rows[i][5].ToString(); goods.strFMaterialQty = ds.Tables[0].Rows[i][6].ToString(); //goods.strFImagePath = ds.Tables[0].Rows[i][5].ToString(); } } } } return(goods); }
private void btnCancleClick(object sender, EventArgs e) { //新增取消 if (toolbar1.flag == 0) { ClearControls(); UpdateBindings(context); SetControlsReadOnly(true); isEdit = false; } else { //BindControls(); //FreshJch(); GridRow selectRow = superGridControl1.PrimaryGrid.ActiveRow as GridRow; good = goodmethod.Find(selectRow["ModelName"].Value.ToString()); if (good != null) { tbModelNo.Text = good.strModelNo; tbModelName.Text = good.strModelName; cbtypestep1.SelectedValue = good.strFTypeSteps1 == null ? "" : good.strFTypeSteps1; cbtypestep2.SelectedValue = good.strFTypeSteps2 == null ? "" : good.strFTypeSteps2; cbtypestep3.SelectedValue = good.strFTypeSteps3 == null ? "" : good.strFTypeSteps3; pictureBox1.ImageLocation = good.strFImagePath; ckbIsstop.Checked = good.iFIsStop == 1; tbmqty.Text = good.strFMaterialQty; } //UpdateBindings(context); SetControlsReadOnly(true); isEdit = false; } }
public int tb_ModelInfoAdd( tb_ModelInfo good ) { int intFalg = 0; try { string str_Add = @"INSERT INTO [dbo].[tb_ModelInfo] ([ModelNo] ,[ModelName] ,[FCreater] ,[FCreateDate] ,[FModifier] ,[FModifydate] ,[FImagePath] ,[FTypeSteps1] ,[FTypeSteps2] ,[FTypeSteps3] ,[FIsStop] ,FMaterialQty) VALUES ("; str_Add += " '" + good.strModelNo + "','" + good.strModelName + "',"; str_Add += " '" + good.strFCreater + "',"; str_Add += " '" + good.dFCreateDate + "','" + good.strFModifier + "','" + good.dFModifydate + "','" + good.strFImagePath + "',"; str_Add += "'" + good.strFTypeSteps1 + "','" + good.strFTypeSteps2 + "','" + good.strFTypeSteps3 + "'," + good.iFIsStop + ",'" + good.strFMaterialQty + "')"; string sql = "select Count(1) from tb_ModelInfo where ModelNo='" + good.strModelNo + "'"; //SqlCommand cmd1 = new SqlCommand(sql, conn); int count = dbc.ExecuteSelect(sql); if (count > 0) { MessageUtil.ShowError("器型编号已存在!"); return(0); } else { intFalg = dbc.ExeInfochange(str_Add); //} return(intFalg); } } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }