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; } } } } } }
public int tb_ColorUpdate(tb_ColorInfo good, string colorno) { int intFalg = 0; try { string str_Update = "update tb_ColorInfo set "; str_Update += "ColorNo='" + good.strColorNo + "', "; str_Update += "ColorName='" + good.strColorName + "',"; str_Update += "FModifier='" + good.strFModifier + "',"; str_Update += "FModifydate= '" + good.dFModifydate + "',"; //str_Update += "FTypeSteps1='" + good.strFTypeSteps1 + "',FTypeSteps2 ='" + good.strFTypeSteps2 + "',"; str_Update += "FColorSteps= '" + good.strFColorSteps + "',FIsStop =" + good.iFIsStop; str_Update += " where ColorNo='" + colorno + "'"; intFalg = dbc.ExeInfochange(str_Update); return(intFalg); // conn.Dispose(); //return intFalg; } catch (Exception ee) { MessageBox.Show(ee.ToString()); return(intFalg); } }
private void btnCancleClick(object sender, EventArgs e) { //新增取消 if (toolbar1.flag == 0) { ClearControls(); UpdateBindings(context); SetControlsReadOnly(true); } else { //BindControls(); //FreshJch(); //UpdateBindings(context); GridRow selectRow = superGridControl1.PrimaryGrid.ActiveRow as GridRow; good = goodmethod.Find(selectRow["ColorNo"].Value.ToString()); if (good != null) { tbColorNo.Text = good.strColorNo; tbColorName.Text = good.strColorName; cmbtypestep.SelectedValue = string.IsNullOrEmpty(good.strFColorSteps) ? "" : good.strFColorSteps; ckbIsStop.Checked = good.iFIsStop == 1; } SetControlsReadOnly(true); } }
private void cmbColor_Leave(object sender, EventArgs e) { tb_ColorInfo color = new tb_ColorInfo(); tb_ColorInfoMethod colorM = new tb_ColorInfoMethod(); if (cmbColor.SelectedValue != null) { color = colorM.Find(cmbColor.SelectedValue.ToString()); tbfcolorsteps.SelectedValue = color.strFColorSteps == null ? "" : color.strFColorSteps; } else { tbfcolorsteps.Text = ""; } }
public int tb_ColorInfoAdd( tb_ColorInfo good ) { int intFalg = 0; try { string str_Add = @"INSERT INTO [dbo].[tb_ColorInfo] ([ColorNo] ,[ColorName] ,[FCreater] ,[FCreateDate] ,[FModifier] ,[FModifydate] ,[FColorSteps] ,[FIsStop]) VALUES("; str_Add += " '" + good.strColorNo + "','" + good.strColorName + "',"; str_Add += " '" + good.strFCreater + "',"; str_Add += " '" + good.dFCreateDate + "','" + good.strFModifier + "','" + good.dFModifydate + "',"; str_Add += "'" + good.strFColorSteps + "'," + good.iFIsStop + ")"; string sql = "select Count(1) from tb_ColorInfo where ColorNo='" + good.strColorNo + "'"; //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); } }
public tb_ColorInfo Find(string _colorNO) { tb_ColorInfo goods = new tb_ColorInfo(); string sql = "select ColorNo,ColorName,FColorSteps from tb_ColorInfo where ColorNo ='" + _colorNO + "' 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.strColorNo = ds.Tables[0].Rows[i][0].ToString(); goods.strColorName = ds.Tables[0].Rows[i][1].ToString(); goods.strFColorSteps = ds.Tables[0].Rows[i][2].ToString(); } } } } return(goods); }