public static bool Add(Project project, ref string msg) { bool ret = false; if (Find(project.Pn).Count > 0) { msg = "相同料号已经存在"; return(false); } string insertSql = "INSERT INTO HPMS_Project (" + "PN, PNCustomer, Length, AWG, Diff, " + "Single, Tdr, DiffPair, NextPair, FextPair, " + "ReportTempletePath, RomFileMode, RomFilePath, RomWrite, SwitchFilePath, " + "FreSpec, FrePoints, Tdd11, Tdd22, ILD, " + "Skew, Customer,FreSpecFilePath, Speed, ProductTypeL, " + "ProductTypeR, Power, Description,CalFilePath,Keypoint,Srevert,Trevert,Report) VALUES (" + "@pn,@pncustomer,@length,@awg,@diff," + "@single,@tdr,@diffpair,@nextpair,@fextpair," + "@reporttempletepath,@romfilemode,@romfilepath,@romwrite,@switchfilepath," + "@frespec,@frepoints,@tdd11,@tdd22,@ild," + "@skew,@customer,@frespecfilepath,@speed,@producttypel," + "@producttyper,@power,@description,@calfilepath,@keypoint,@srevert,@trevert,@report) "; IDataParameter[] b = new IDataParameter[33]; b[0] = Gloabal.GDatabase.CreatePara("pn", project.Pn); b[1] = Gloabal.GDatabase.CreatePara("pncustomer", project.PnCustomer); b[2] = Gloabal.GDatabase.CreatePara("length", project.Length); b[3] = Gloabal.GDatabase.CreatePara("awg", project.Awg); b[4] = Gloabal.GDatabase.CreatePara("diff", Convert.List2Str(project.Diff)); b[5] = Gloabal.GDatabase.CreatePara("single", Convert.List2Str(project.Single)); b[6] = Gloabal.GDatabase.CreatePara("tdr", Convert.List2Str(project.Tdr)); b[7] = Gloabal.GDatabase.CreatePara("diffpair", Convert.List2Str(project.DiffPair)); b[8] = Gloabal.GDatabase.CreatePara("nextpair", Convert.List2Str(project.NextPair)); b[9] = Gloabal.GDatabase.CreatePara("fextpair", Convert.List2Str(project.FextPair)); b[10] = Gloabal.GDatabase.CreatePara("reporttempletepath", project.ReportTempletePath); b[11] = Gloabal.GDatabase.CreatePara("romfilemode", project.RomFileMode.ToString()); b[12] = Gloabal.GDatabase.CreatePara("romfilepath", project.RomFilePath); b[13] = Gloabal.GDatabase.CreatePara("romwrite", project.RomWrite); b[14] = Gloabal.GDatabase.CreatePara("switchfilepath", project.SwitchFilePath); b[15] = Gloabal.GDatabase.CreatePara("frespec", project.FreSpec); b[16] = Gloabal.GDatabase.CreatePara("frepoints", project.FrePoints); b[17] = Gloabal.GDatabase.CreatePara("tdd11", Serializer.Object2Json(project.Tdd11)); b[18] = Gloabal.GDatabase.CreatePara("tdd22", Serializer.Object2Json(project.Tdd22)); b[19] = Gloabal.GDatabase.CreatePara("ild", project.Ild.ToString()); b[20] = Gloabal.GDatabase.CreatePara("skew", project.Skew); b[21] = Gloabal.GDatabase.CreatePara("customer", project.Customer); b[22] = Gloabal.GDatabase.CreatePara("frespecfilepath", project.FreSpecFilePath); b[23] = Gloabal.GDatabase.CreatePara("speed", project.Speed); b[24] = Gloabal.GDatabase.CreatePara("producttypel", project.ProductTypeL); b[25] = Gloabal.GDatabase.CreatePara("producttyper", project.ProductTypeR); b[26] = Gloabal.GDatabase.CreatePara("power", project.Power); b[27] = Gloabal.GDatabase.CreatePara("description", project.Description); b[28] = Gloabal.GDatabase.CreatePara("calfilepath", project.CalFilePath); b[29] = Gloabal.GDatabase.CreatePara("keypoint", project.KeyPoint); b[30] = Gloabal.GDatabase.CreatePara("srevert", project.Srevert); b[31] = Gloabal.GDatabase.CreatePara("trevert", project.Trevert); b[32] = Gloabal.GDatabase.CreatePara("report", project.Report); int insertCount = Gloabal.GDatabase.ExecuteSql(insertSql, b); if (insertCount == 1) { ret = true; } else { msg = "添加新料号失败"; } return(ret); }
public static bool Update(Project project, ref string msg) { bool ret = false; string updateSql = "UPDATE HPMS_Project SET" + " PNCustomer = @pncustomer, Length = @length, AWG = @awg, Diff = @diff, Single = @single," + "Tdr = @tdr,DiffPair = @diffpair,NextPair = @nextpair,FextPair = @fextpair,ReportTempletePath = @reporttempletepath," + "RomFileMode = @romfilemode,RomFilePath = @romfilepath,RomWrite = @romwrite,SwitchFilePath = @switchfilepath,FreSpec = @frespec," + "FrePoints = @frepoints,Tdd11 =@tdd11,Tdd22 = @tdd22,ILD = @ild,Skew = @skew," + "Customer = @customer,FreSpecFilePath = @frespecfilepath, Speed = @speed,ProductTypeL = @producttypel,ProductTypeR = @producttyper," + "Power = @power, Description = @description,CalFilePath = @calfilepath,Keypoint = @keypoint,Srevert=@srevert,Trevert=@trevert,Report=@report where PN = @pn "; IDataParameter[] b = new IDataParameter[33]; b[0] = Gloabal.GDatabase.CreatePara("pn", project.Pn); b[1] = Gloabal.GDatabase.CreatePara("pncustomer", project.PnCustomer); b[2] = Gloabal.GDatabase.CreatePara("length", project.Length); b[3] = Gloabal.GDatabase.CreatePara("awg", project.Awg); b[4] = Gloabal.GDatabase.CreatePara("diff", Convert.List2Str(project.Diff)); b[5] = Gloabal.GDatabase.CreatePara("single", Convert.List2Str(project.Single)); b[6] = Gloabal.GDatabase.CreatePara("tdr", Convert.List2Str(project.Tdr)); b[7] = Gloabal.GDatabase.CreatePara("diffpair", Convert.List2Str(project.DiffPair)); b[8] = Gloabal.GDatabase.CreatePara("nextpair", Convert.List2Str(project.NextPair)); b[9] = Gloabal.GDatabase.CreatePara("fextpair", Convert.List2Str(project.FextPair)); b[10] = Gloabal.GDatabase.CreatePara("reporttempletepath", project.ReportTempletePath); b[11] = Gloabal.GDatabase.CreatePara("romfilemode", project.RomFileMode.ToString()); b[12] = Gloabal.GDatabase.CreatePara("romfilepath", project.RomFilePath); b[13] = Gloabal.GDatabase.CreatePara("romwrite", project.RomWrite); b[14] = Gloabal.GDatabase.CreatePara("switchfilepath", project.SwitchFilePath); b[15] = Gloabal.GDatabase.CreatePara("frespec", project.FreSpec); b[16] = Gloabal.GDatabase.CreatePara("frepoints", project.FrePoints); b[17] = Gloabal.GDatabase.CreatePara("tdd11", Serializer.Object2Json(project.Tdd11)); b[18] = Gloabal.GDatabase.CreatePara("tdd22", Serializer.Object2Json(project.Tdd22)); b[19] = Gloabal.GDatabase.CreatePara("ild", project.Ild.ToString()); b[20] = Gloabal.GDatabase.CreatePara("skew", project.Skew); b[21] = Gloabal.GDatabase.CreatePara("customer", project.Customer); b[22] = Gloabal.GDatabase.CreatePara("frespecfilepath", project.FreSpecFilePath); b[23] = Gloabal.GDatabase.CreatePara("speed", project.Speed); b[24] = Gloabal.GDatabase.CreatePara("producttypel", project.ProductTypeL); b[25] = Gloabal.GDatabase.CreatePara("producttyper", project.ProductTypeR); b[26] = Gloabal.GDatabase.CreatePara("power", project.Power); b[27] = Gloabal.GDatabase.CreatePara("description", project.Description); b[28] = Gloabal.GDatabase.CreatePara("calfilepath", project.CalFilePath); b[29] = Gloabal.GDatabase.CreatePara("keypoint", project.KeyPoint); b[30] = Gloabal.GDatabase.CreatePara("srevert", project.Srevert); b[31] = Gloabal.GDatabase.CreatePara("trevert", project.Trevert); b[32] = Gloabal.GDatabase.CreatePara("report", project.Report); int updateCount = Gloabal.GDatabase.ExecuteSql(updateSql, b); if (updateCount == 1) { ret = true; } return(ret); }