public static void SetAutoNum(AutoNum val, SqlConnection cn) { SortingClass.CheckColumn("CompetitionData", "AutoNum", "VARCHAR(3) NOT NULL DEFAULT '" + AutoNum.GRP.ToString() + "'", cn); SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandText = "UPDATE CompetitionData SET AutoNum='" + val.ToString() + "'"; cmd.ExecuteNonQuery(); }
protected override void BeforeSave(Dictionary <string, string> dic, S_UI_Form formInfo, bool isNew) { base.BeforeSave(dic, formInfo, isNew); var id = dic.GetValue("ID"); var isDomestic = dic.GetValue("IsDomestic"); var code = dic.GetValue("SupplierCode"); //验证编号重复 var exist = this.EPCEntites.Set <S_I_SupplierInfo>().FirstOrDefault(a => a.ID != id && a.SupplierCode == code); //最新编号 if (exist != null) { int AutoNum; var Code = createCode(isDomestic, out AutoNum); dic.SetValue("SupplierCode", Code); dic.SetValue("AutoNum", AutoNum.ToString()); } }