public static bool AddCurve(string Code, WSV.Model.Weight.WeightModel value) { DataBase db = new DataBase(); DataBaseVisitor visitor = new DAL.MyLog.DL_WeightVisitor(); bool retvalue = true; SqlParameter[] prams ={ db.MakeInParam("@Code",SqlDbType.VarChar,50,Code) }; SqlDataReader Reader = null; try { db.GetDataReader(visitor, prams, out Reader, "AddCurve"); if (Reader.Read()) { value.StateFun.Curve = (byte[])Reader["Curve"]; } else { retvalue = false; } } catch (Exception e) { db.Dispose(); return false; } finally { db.Dispose(); } return retvalue; }
/// <summary> /// 添加数据 /// </summary> /// <param name="Item">model</param> /// <returns></returns> public static string AddData(WSV.Model.Weight.WeightModel Weight) { DataBase db = new DataBase(); DataBaseVisitor visitor = new WSV.DAL.MyLog.OperData(); bool bSuc = false; int nEffectRows = 0; SqlParameter[] prams ={ db.MakeInParam("@ID", SqlDbType.Int,4, BLL.PublicFun.PublicFun.MaxId("D_Saver")), db.MakeInParam("@Code", SqlDbType.VarChar,50, Weight.Code), db.MakeInParam("@CarCode", SqlDbType.VarChar,50, Weight.Txt.CarCode), db.MakeInParam("@Item", SqlDbType.VarChar,50, Weight.Txt.Item), db.MakeInParam("@Specs", SqlDbType.VarChar,50, Weight.Txt.Specs), db.MakeInParam("@Place", SqlDbType.VarChar,50, Weight.Txt.Place), db.MakeInParam("@Send", SqlDbType.VarChar,50, Weight.Txt.Send), db.MakeInParam("@Accept", SqlDbType.VarChar,50, Weight.Txt.Accept), db.MakeInParam("@Carry", SqlDbType.VarChar,50, Weight.Txt.Carry), db.MakeInParam("@Model", SqlDbType.VarChar,50, Weight.Txt.Model), db.MakeInParam("@Driver", SqlDbType.VarChar,50, Weight.Txt.Driver), db.MakeInParam("@Spare", SqlDbType.VarChar,50, Weight.Txt.Spare), db.MakeInParam("@Type", SqlDbType.VarChar,50, Weight.Txt.Type), db.MakeInParam("@Card", SqlDbType.VarChar,50, Weight.Txt.Card), db.MakeInParam("@Plan_Code", SqlDbType.VarChar,50, Weight.Txt.Plan_Code), db.MakeInParam("@G_Table", SqlDbType.VarChar,50, Weight.StateFun.G_Table), db.MakeInParam("@T_Table", SqlDbType.VarChar,50, Weight.StateFun.T_Table), db.MakeInParam("@G_Oper", SqlDbType.VarChar,50, Weight.StateFun.G_Oper), db.MakeInParam("@T_Oper", SqlDbType.VarChar,50, Weight.StateFun.T_Oper), db.MakeInParam("@Gross", SqlDbType.Decimal, 10, Weight.Float.Gross), db.MakeInParam("@Tare", SqlDbType.Decimal, 10, Weight.Float.Tare), db.MakeInParam("@Net", SqlDbType.Decimal, 10, Weight.Float.Net), db.MakeInParam("@EndNet", SqlDbType.Decimal, 10, Weight.Float.EndNet), db.MakeInParam("@Impurity", SqlDbType.Decimal, 10, Weight.Float.Impurity), db.MakeInParam("@ImpurityRate", SqlDbType.Decimal, 10, Weight.Float.ImpurityRate), db.MakeInParam("@DeductWei", SqlDbType.Decimal, 10, Weight.Float.DeductWei), db.MakeInParam("@DeductRate", SqlDbType.Decimal, 10, Weight.Float.DeductRate), db.MakeInParam("@Cube", SqlDbType.Decimal, 10, Weight.Float.Cube), db.MakeInParam("@Cubety", SqlDbType.Decimal, 10, Weight.Float.Cubety), db.MakeInParam("@InhereWei", SqlDbType.Decimal, 10, Weight.Float.InhereWei), db.MakeInParam("@DifferWei", SqlDbType.Decimal, 10, Weight.Float.DifferWei), db.MakeInParam("@Price", SqlDbType.Decimal, 10, Weight.Float.Price), db.MakeInParam("@Money", SqlDbType.Decimal, 10, Weight.Float.Money), db.MakeInParam("@State", SqlDbType.Decimal, 10, Weight.StateFun.State), db.MakeInParam("@G_Time", SqlDbType.VarChar, 50, Weight.StateFun.G_Time), db.MakeInParam("@T_Time", SqlDbType.VarChar, 50, Weight.StateFun.T_Time), db.MakeInParam("@N_Time", SqlDbType.VarChar, 50, Weight.StateFun.N_Time), }; try { bSuc = db.TransactSql(visitor, "AddData", prams, out nEffectRows); } catch (Exception ex) { throw new Exception(ex.Message); } finally { db.Dispose(); } if (bSuc && nEffectRows > 0) return "0101"; else return "0"; }
/// <summary> /// 读取主表数据库数据 /// </summary> /// <param name="Weight">model</param> public static void GetDate(ref WSV.Model.Weight.WeightModel Weight) { DataBase db = new DataBase(); DataBaseVisitor visitor = new WSV.DAL.MyLog.OperData(); SqlDataReader oddr = null; SqlParameter[] prams ={ db.MakeInParam("@Code", SqlDbType.VarChar,50, Weight.Code), }; try { db.GetDataReader(visitor, prams, out oddr, "SelectByCode"); if (oddr.Read()) { Weight.StateFun.Verify = Convert.ToBoolean(oddr["Verify"]); Weight.StateFun.Used = Convert.ToBoolean(oddr["Used"]); Weight.Txt.CarCode = oddr["CarCode"].ToString(); Weight.Txt.Item = oddr["Item"].ToString(); Weight.Txt.Specs = oddr["Specs"].ToString(); Weight.Txt.Place = oddr["Place"].ToString(); Weight.Txt.Send = oddr["Send"].ToString(); Weight.Txt.Accept = oddr["Accept"].ToString(); Weight.Txt.Carry = oddr["Carry"].ToString(); Weight.Txt.Model = oddr["Model"].ToString(); Weight.Txt.Driver = oddr["Driver"].ToString(); Weight.Txt.Spare = oddr["Spare"].ToString(); Weight.Txt.Card = oddr["Card"].ToString(); Weight.Txt.Plan_Code = oddr["Plan_Code"].ToString(); Weight.Txt.Type = oddr["Type"].ToString(); Weight.StateFun.G_Oper = oddr["G_Oper"].ToString(); Weight.StateFun.T_Oper = oddr["T_Oper"].ToString(); Weight.StateFun.G_Table = oddr["G_Table"].ToString(); Weight.StateFun.T_Table = oddr["T_Table"].ToString(); Weight.Float.Gross = Convert.ToDecimal(oddr["Gross"]); Weight.Float.Tare = Convert.ToDecimal(oddr["Tare"]); Weight.Float.Net = Convert.ToDecimal(oddr["Net"]); Weight.Float.EndNet = Convert.ToDecimal(oddr["EndNet"]); Weight.Float.Impurity = Convert.ToDecimal(oddr["Impurity"]); Weight.Float.ImpurityRate = Convert.ToDecimal(oddr["ImpurityRate"]); Weight.Float.DeductWei = Convert.ToDecimal(oddr["DeductWei"]); Weight.Float.DeductRate = Convert.ToDecimal(oddr["DeductRate"]); Weight.Float.Cube = Convert.ToDecimal(oddr["Cube"]); Weight.Float.InhereWei = Convert.ToDecimal(oddr["InhereWei"]); Weight.Float.DifferWei = Convert.ToDecimal(oddr["DifferWei"]); Weight.Float.Price = Convert.ToDecimal(oddr["Price"]); Weight.Float.Money = Convert.ToDecimal(oddr["Money"]); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { oddr.Close(); db.Dispose(); } }
private void Round(WSV.Control.MyComboBox.MyComboBox Cmb) { Cmb.Items.Add("四舍五入", 0); Cmb.Items.Add("抹除取整", 1); }
private void Digit(WSV.Control.MyComboBox.MyComboBox Cmb) { Cmb.Items.Add("一位小数", 1); Cmb.Items.Add("两位小数", 2); Cmb.Items.Add("三位小数", 3); }