Exemplo n.º 1
0
 /// <summary>
 /// ���ؽ����ѯ
 /// </summary>
 /// <param name="s_Pr"></param>
 /// <param name="s_pr1"></param>
 /// <returns></returns>
 public static bool SelectName(string flag, WeightModel Item)
 {
     bool retvalue = true;
     if (flag == "")
     {
         return false;
     }
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new DAL.Weight.PlanDAL();
     SqlParameter[] prams ={
         db.MakeInParam ("@flag",SqlDbType.VarChar ,50,flag ),
     };
     SqlDataReader getReader = null;
     try
     {
         db.GetDataReader(visitor, prams, out getReader, "selectCode");
         if (getReader.Read())
         {
            Item.Txt.Plan_Code=getReader["Plan_Code"].ToString();
         }
         else
         {
             retvalue = false;
         }
         getReader.Close();
     }
     catch (Exception err)
     {
         db.Dispose();
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalue;
 }
Exemplo n.º 2
0
        /// <summary>
        /// ���濨��
        /// </summary>
        /// <param name="values"></param>
        public static void Save_Card(WeightModel values)
        {
            DataBase db = new DataBase();
            DataBaseVisitor visitor = new WSV.DAL.Weight.CardDAL();

            SqlParameter[] prams ={
                db.MakeInParam("@ID", SqlDbType.BigInt,50, PublicFun.PublicFun.MaxId("D_Card")),
                db.MakeInParam("@Card",SqlDbType.VarChar,50,values.Txt.Card),
                db.MakeInParam("@CarCode",SqlDbType.VarChar,50,values.Txt.CarCode),
                db.MakeInParam("@Type",SqlDbType.VarChar,50,values.Txt.Type),
                db.MakeInParam("@Item",SqlDbType.VarChar,50,values.Txt.Item),
                db.MakeInParam("@Specs",SqlDbType.VarChar,50,values.Txt.Specs),
                db.MakeInParam("@Place",SqlDbType.VarChar,50,values.Txt.Place),
                db.MakeInParam("@Send",SqlDbType.VarChar,50,values.Txt.Send),
                db.MakeInParam("@Accept",SqlDbType.VarChar,50,values.Txt.Accept),
                db.MakeInParam("@Carry",SqlDbType.VarChar,50,values.Txt.Carry),
                db.MakeInParam("@Model",SqlDbType.VarChar,50,values.Txt.Model),
                db.MakeInParam("@Driver",SqlDbType.VarChar,50,values.Txt.Driver),
                db.MakeInParam("@Spare",SqlDbType.VarChar,50,values.Txt.Spare),
                db.MakeInParam("@Tare",SqlDbType.Float,50,values.Float.Tare),
                db.MakeInParam("@State",SqlDbType.Bit,1,values.StateFun.State)
                    };
            try
            {
                db.TransactSql(visitor, "Save_Card", prams);
            }
            catch (Exception err)
            {
                db.Dispose();
                MessageBox.Show("���ݲ�ȫ��", "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                db.Dispose();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// ��ѯ��ǰ����
 /// </summary>
 /// <param name="Card"></param>
 /// <param name="Item"></param>
 /// <returns></returns>
 public static bool SelectCard(string Card, WeightModel Item)
 {
     bool retvalues = true;
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WeightDAL();
     SqlParameter[] prams ={
          db.MakeInParam("@Card",SqlDbType.VarChar,50,Card)
     };
     SqlDataReader getread = null;
     db.GetDataReader(visitor, prams, out getread, "SelectCard");
     try
     {
         if (getread.Read())
         {
             Item.Txt.Type = getread["Type"].ToString();
             Item.Txt.Item = getread["Item"].ToString();
             Item.Txt.Specs = getread["Specs"].ToString();
             Item.Txt.Place = getread["Place"].ToString();
             Item.Txt.Send = getread["Send"].ToString();
             Item.Txt.Accept = getread["Accept"].ToString();
             Item.Txt.Carry = getread["Carry"].ToString();
             Item.Txt.Model = getread["Model"].ToString();
             Item.Txt.Driver = getread["Driver"].ToString();
             Item.Txt.Spare = getread["Spare"].ToString();
             Item.Txt.CarCode = getread["CarCode"].ToString();
             Item.Float.Tare = Convert.ToDecimal(getread["Tare"].ToString());
         }
         else
         {
             return retvalues = false;
         }
         getread.Close();
     }
     catch (Exception e)
     {
         db.Dispose();
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalues;
 }
Exemplo n.º 4
0
        /// <summary>
        /// ��ѯ���ű���Ƿ񱣴浱ǰ����
        /// </summary>
        /// <param name="CarCode"></param>
        /// <param name="Item"></param>
        /// <returns></returns>
        public static bool SelectCarCode1(string CarCode, WeightModel Item)
        {
            bool retvalue = true;
            DataBase db = new DataBase();
            DataBaseVisitor visitor = new DAL.Weight.WeightDAL();
            SqlParameter[] prams ={
                db.MakeInParam ("@CarCode",SqlDbType.VarChar ,50,CarCode )
            };

            SqlDataReader getReader = null;
            try
            {
                db.GetDataReader(visitor, prams, out getReader, "selectCarCode1");
                if (getReader.Read())
                {
                    Item.Txt.CarCode = getReader["CarCode"].ToString();
                    Item.Txt.Driver = getReader["Driver"].ToString();
                    Item.Float.Tare = Convert.ToDecimal(getReader["Tare"].ToString());
                }
                else
                {
                    retvalue = false;
                }
                getReader.Close();
            }
            catch (Exception err)
            {
                db.Dispose();
                return false;
            }
            finally
            {
                db.Dispose();
            }
            return retvalue;
        }
Exemplo n.º 5
0
 /// <summary>
 /// ��ѯ���ţ������ص�ǰֵ
 /// </summary>
 /// <param name="CarCode"></param>
 /// <param name="Item"></param>
 /// <returns></returns>
 public static bool SelectCarCode(string CarCode, WeightModel Item)
 {
     bool retvalue = true;
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new DAL.Weight.WeightDAL();
     SqlParameter[] prams ={
         db.MakeInParam ("@CarCode",SqlDbType.VarChar ,50,CarCode )
     };
     SqlDataReader getReader = null;
     try
     {
         db.GetDataReader(visitor, prams, out getReader, "selectCarCode");
         if (getReader.Read())
         {
             Item.Txt.Type = getReader["Type"].ToString();
             Item.Code = getReader["Code"].ToString();
             Item.Txt.Item = getReader["Item"].ToString();
             Item.Txt.Specs = getReader["Specs"].ToString();
             Item.Txt.Place = getReader["Place"].ToString();
             Item.Txt.Accept = getReader["Accept"].ToString();
             Item.Txt.Send = getReader["Send"].ToString();
             Item.Txt.Carry = getReader["Carry"].ToString();
             Item.StateFun.G_Oper = getReader["G_Oper"].ToString();
             Item.StateFun.T_Oper = getReader["T_Oper"].ToString();
             Item.StateFun.G_Time = getReader["G_Time"].ToString();
             Item.StateFun.T_Time = getReader["T_Time"].ToString();
             Item.Txt.Driver = getReader["Driver"].ToString();
             Item.Txt.Model = getReader["Model"].ToString();
             Item.Txt.Spare = getReader["Spare"].ToString();
             Item.Txt.Plan_Code = getReader["Plan_Code"].ToString();
             Item.Float.Cube = Convert.ToDecimal(getReader["Cube"].ToString());
             Item.Float.Cubety = Convert.ToDecimal(getReader["Cubety"].ToString());
             Item.Float.InhereWei = Convert.ToDecimal(getReader["InhereWei"].ToString());
             Item.Float.DifferWei = Convert.ToDecimal(getReader["DifferWei"].ToString());
             Item.Float.Gross = Convert.ToDecimal(getReader["Gross"].ToString());
             Item.Float.Tare = Convert.ToDecimal(getReader["Tare"].ToString());
         }
         else
         {
             retvalue = false;
         }
         getReader.Close();
     }
     catch (Exception err)
     {
         db.Dispose();
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalue;
 }
Exemplo n.º 6
0
 /// <summary>
 /// ���ؽ����ı���ģ����ѯ
 /// </summary>
 /// <param name="flag"></param>
 /// <param name="flag1"></param>
 /// <param name="Item"></param>
 /// <returns></returns>
 public static bool selectByFlag(string flag, string flag1,int PortId2, WeightModel Item)
 {
     bool retvalue = true;
     if (flag1 == "")
     {
         return false;
     }
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new DAL.Weight.WeightDAL();
     SqlParameter[] prams ={
         db.MakeInParam ("@flag",SqlDbType.VarChar ,50,flag ),
         db.MakeInParam("@flag1",SqlDbType.VarChar,50,flag1),
         db.MakeInParam("@PortId2",SqlDbType.Int,50,PortId2)
     };
     SqlDataReader getReader = null;
     try
     {
         db.GetDataReader(visitor, prams, out getReader, "selectByFlag");
         if (getReader.Read())
         {
             Item.Txt.IdCard = getReader["Code"].ToString();
             Item.Txt.Name = getReader["Name"].ToString();
         }
         else
         {
             retvalue = false;
         }
         getReader.Close();
     }
     catch (Exception err)
     {
         db.Dispose();
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalue;
 }
Exemplo n.º 7
0
        /// <summary>
        /// ����ͼƬ
        /// </summary>
        /// <param name="Sql"></param>
        /// <param name="retselectflag"></param>
        /// <param name="Values"></param>
        public static void Save_Video(string Sql, bool retselectflag, WeightModel Values)
        {
            DataBase db = new DataBase();
            DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
            SqlParameter[] prams = new SqlParameter[5];
            if (!retselectflag)
            {
                if (Sql == "insertM")
                {
                    prams[0] = db.MakeInParam("@Code", SqlDbType.VarChar, 50, Values.Code);
                    if (Values.StateFun.G_Image1 != null)
                        prams[1] = db.MakeInParam("@G_Image1", SqlDbType.Binary, Values.StateFun.G_Image1.Length, Values.StateFun.G_Image1);
                    else
                        prams[1] = db.MakeInParam("@G_Image1", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.G_Image2 != null)
                        prams[2] = db.MakeInParam("@G_Image2", SqlDbType.Binary, Values.StateFun.G_Image2.Length, Values.StateFun.G_Image2);
                    else
                        prams[2] = db.MakeInParam("@G_Image2", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.G_Image3 != null)
                        prams[3] = db.MakeInParam("@G_Image3", SqlDbType.Binary, Values.StateFun.G_Image3.Length, Values.StateFun.G_Image3);
                    else
                        prams[3] = db.MakeInParam("@G_Image3", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.G_Image4 != null)
                        prams[4] = db.MakeInParam("@G_Image4", SqlDbType.Binary, Values.StateFun.G_Image4.Length, Values.StateFun.G_Image4);
                    else
                        prams[4] = db.MakeInParam("@G_Image4", SqlDbType.Binary, 0, DBNull.Value);
                }
                else if (Sql == "insertP")
                {
                    prams[0] = db.MakeInParam("@Code", SqlDbType.VarChar, 50, Values.Code);
                    if (Values.StateFun.T_Image1 != null)
                        prams[1] = db.MakeInParam("@T_Image1", SqlDbType.Binary, Values.StateFun.T_Image1.Length, Values.StateFun.T_Image1);
                    else
                        prams[1] = db.MakeInParam("@T_Image1", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.T_Image2 != null)
                        prams[2] = db.MakeInParam("@T_Image2", SqlDbType.Binary, Values.StateFun.T_Image2.Length, Values.StateFun.T_Image2);
                    else
                        prams[2] = db.MakeInParam("@T_Image2", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.T_Image3 != null)
                        prams[3] = db.MakeInParam("@T_Image3", SqlDbType.Binary, Values.StateFun.T_Image3.Length, Values.StateFun.T_Image3);
                    else
                        prams[3] = db.MakeInParam("@T_Image3", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.T_Image4 != null)
                        prams[4] = db.MakeInParam("@T_Image4", SqlDbType.Binary, Values.StateFun.T_Image4.Length, Values.StateFun.T_Image4);
                    else
                        prams[4] = db.MakeInParam("@T_Image4", SqlDbType.Binary, 0, DBNull.Value);
                }
            }
            else
            {
                if (Sql == "updateM")
                {
                    prams[0] = db.MakeInParam("@Code", SqlDbType.VarChar, 50, Values.Code);
                    if (Values.StateFun.G_Image1 != null)
                        prams[1] = db.MakeInParam("@G_Image1", SqlDbType.Binary, Values.StateFun.G_Image1.Length, Values.StateFun.G_Image1);
                    else
                        prams[1] = db.MakeInParam("@G_Image1", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.G_Image2 != null)
                        prams[2] = db.MakeInParam("@G_Image2", SqlDbType.Binary, Values.StateFun.G_Image2.Length, Values.StateFun.G_Image2);
                    else
                        prams[2] = db.MakeInParam("@G_Image2", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.G_Image3 != null)
                        prams[3] = db.MakeInParam("@G_Image3", SqlDbType.Binary, Values.StateFun.G_Image3.Length, Values.StateFun.G_Image3);
                    else
                        prams[3] = db.MakeInParam("@G_Image3", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.G_Image4 != null)
                        prams[4] = db.MakeInParam("@G_Image4", SqlDbType.Binary, Values.StateFun.G_Image4.Length, Values.StateFun.G_Image4);
                    else
                        prams[4] = db.MakeInParam("@G_Image4", SqlDbType.Binary, 0, DBNull.Value);
                }
                else if (Sql == "updateP")
                {
                    prams[0] = db.MakeInParam("@Code", SqlDbType.VarChar, 50, Values.Code);
                    if (Values.StateFun.T_Image1 != null)
                        prams[1] = db.MakeInParam("@T_Image1", SqlDbType.Binary, Values.StateFun.T_Image1.Length, Values.StateFun.T_Image1);
                    else
                        prams[1] = db.MakeInParam("@T_Image1", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.T_Image2 != null)
                        prams[2] = db.MakeInParam("@T_Image2", SqlDbType.Binary, Values.StateFun.T_Image2.Length, Values.StateFun.T_Image2);
                    else
                        prams[2] = db.MakeInParam("@T_Image2", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.T_Image3 != null)
                        prams[3] = db.MakeInParam("@T_Image3", SqlDbType.Binary, Values.StateFun.T_Image3.Length, Values.StateFun.T_Image3);
                    else
                        prams[3] = db.MakeInParam("@T_Image3", SqlDbType.Binary, 0, DBNull.Value);

                    if (Values.StateFun.T_Image4 != null)
                        prams[4] = db.MakeInParam("@T_Image4", SqlDbType.Binary, Values.StateFun.T_Image4.Length, Values.StateFun.T_Image4);
                    else
                        prams[4] = db.MakeInParam("@T_Image4", SqlDbType.Binary, 0, DBNull.Value);
                }
            }
            try
            {
                db.TransactSql(visitor, Sql, prams);
            }
            catch (Exception err)
            {
                db.Dispose();
                MessageBox.Show("����" + err.Message, "������Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                db.Dispose();
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// �����¼�����
 /// </summary>
 /// <param name="Sql"></param>
 /// <param name="values"></param>
 public static void Save_Data(string Sql, WeightModel values)
 {
     //�����¼�
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     if (Sql == "yucun")
     {
         SqlParameter[] prams ={
                 db.MakeInParam("@ID", SqlDbType.BigInt,50, PublicFun.PublicFun.MaxId("D_Saver")),
                 db.MakeInParam("@Code", SqlDbType.VarChar,50, values.Code),
               db.MakeInParam("@Card",SqlDbType.VarChar,50,values.Txt.Card),
                 db.MakeInParam("@CarCode", SqlDbType.VarChar,50, values.Txt.CarCode),
                 db.MakeInParam("@Type", SqlDbType.VarChar,50, values.Txt.Type),
                 db.MakeInParam("@Item", SqlDbType.VarChar,50, values.Txt.Item),
                 db.MakeInParam("@Specs", SqlDbType.VarChar,50, values.Txt.Specs),
                 db.MakeInParam("@Place", SqlDbType.VarChar,50, values.Txt.Place),
                 db.MakeInParam("@Send", SqlDbType.VarChar,50, values.Txt.Send),
                 db.MakeInParam("@Accept", SqlDbType.VarChar,50, values.Txt.Accept),
                 db.MakeInParam("@Carry", SqlDbType.VarChar,50, values.Txt.Carry),
                 db.MakeInParam("@Model", SqlDbType.VarChar,50,values.Txt.Model),
                 db.MakeInParam("@Cube", SqlDbType.Decimal,50, values.Float.Cube),
                 db.MakeInParam("@Cubety", SqlDbType.Decimal,50, values.Float.Cubety),
                 db.MakeInParam("@InhereWei", SqlDbType.Decimal,50, values.Float.InhereWei),
                 db.MakeInParam("@DifferWei", SqlDbType.Decimal,50, values.Float.DifferWei),
                 db.MakeInParam("@Driver", SqlDbType.VarChar,50, values.Txt.Driver),
                 db.MakeInParam("@Spare", SqlDbType.VarChar,50, values.Txt.Spare),
                 db.MakeInParam("@Gross", SqlDbType.Decimal,50, values.Float.Gross),
                 db.MakeInParam("@G_Time",SqlDbType.VarChar,50,values.StateFun.G_Time),
                 db.MakeInParam("@Tare", SqlDbType.Decimal,50, values.Float.Tare),
                 db.MakeInParam("@T_Time",SqlDbType.VarChar,50,values.StateFun.T_Time),
                 db.MakeInParam("@Net",SqlDbType.Decimal,50,values.Float.Net),
                 db.MakeInParam("@EndNet",SqlDbType.Decimal,50,values.Float.EndNet),
                 db.MakeInParam("@N_Time",SqlDbType.VarChar,50,values.StateFun.N_Time),
                 db.MakeInParam("@Price",SqlDbType.Decimal,50,values.Float.Price),
                 db.MakeInParam("@Money",SqlDbType.Decimal,50,values.Float.Money),
                 db.MakeInParam("@DeductWei",SqlDbType.Decimal,50,values.Float.DeductWei),
                 db.MakeInParam("@DeductRate",SqlDbType.Decimal,50,values.Float.DeductRate),
                 db.MakeInParam("@Impurity",SqlDbType.Decimal,50,values.Float.Impurity),
                 db.MakeInParam("@ImpurityRate",SqlDbType.Decimal,50,values.Float.ImpurityRate),
                 db.MakeInParam("@G_Oper",SqlDbType.VarChar,50,WSV.Model.User.LUser.Code),
               db.MakeInParam("@Accepter",SqlDbType.VarChar,50,WSV.Model.User.CUser.Code),
                 db.MakeInParam("@State",SqlDbType.Bit,1,1),
                 db.MakeInParam("@Plan_Code",SqlDbType.VarChar,50,values.Txt.Plan_Code)
             };
         try
         {
             db.TransactSql(visitor, Sql, prams);
         }
         catch (Exception err)
         {
             db.Dispose();
             MessageBox.Show("���ݲ�ȫ��", "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         finally
         {
             db.Dispose();
         }
     }
     else if (Sql == "IdCard")
     {
         SqlParameter[] prams ={
                 db.MakeInParam("@ID", SqlDbType.BigInt,50, PublicFun.PublicFun.MaxId("D_Saver")),
                 db.MakeInParam("@Code", SqlDbType.VarChar,50, values.Code),
                 db.MakeInParam("@Card",SqlDbType.VarChar,50,values.Txt.Card),
                 db.MakeInParam("@CarCode", SqlDbType.VarChar,50, values.Txt.CarCode),
                 db.MakeInParam("@Type", SqlDbType.VarChar,50, values.Txt.Type),
                 db.MakeInParam("@Item", SqlDbType.VarChar,50, values.Txt.Item),
                 db.MakeInParam("@Specs", SqlDbType.VarChar,50, values.Txt.Specs),
                 db.MakeInParam("@Place", SqlDbType.VarChar,50, values.Txt.Place),
                 db.MakeInParam("@Send", SqlDbType.VarChar,50, values.Txt.Send),
                 db.MakeInParam("@Accept", SqlDbType.VarChar,50, values.Txt.Accept),
                 db.MakeInParam("@Carry", SqlDbType.VarChar,50, values.Txt.Carry),
                 db.MakeInParam("@Model", SqlDbType.VarChar,50,values.Txt.Model),
                 db.MakeInParam("@Cube", SqlDbType.Decimal,50, values.Float.Cube),
                 db.MakeInParam("@Cubety", SqlDbType.Decimal,50, values.Float.Cubety),
                 db.MakeInParam("@InhereWei", SqlDbType.Decimal,50, values.Float.InhereWei),
                 db.MakeInParam("@DifferWei", SqlDbType.Decimal,50, values.Float.DifferWei),
                 db.MakeInParam("@Driver", SqlDbType.VarChar,50, values.Txt.Driver),
                 db.MakeInParam("@Spare", SqlDbType.VarChar,50, values.Txt.Spare),
                 db.MakeInParam("@Gross", SqlDbType.Decimal,50, values.Float.Gross),
                 db.MakeInParam("@G_Time",SqlDbType.VarChar,50,values.StateFun.G_Time),
                 db.MakeInParam("@Tare", SqlDbType.Decimal,50, values.Float.Tare),
                 db.MakeInParam("@T_Time",SqlDbType.VarChar,50,values.StateFun.T_Time),
                 db.MakeInParam("@Net",SqlDbType.Decimal,50,values.Float.Net),
                 db.MakeInParam("@EndNet",SqlDbType.Decimal,50,values.Float.EndNet),
                 db.MakeInParam("@N_Time",SqlDbType.VarChar,50,values.StateFun.N_Time),
                 db.MakeInParam("@Price",SqlDbType.Decimal,50,values.Float.Price),
                 db.MakeInParam("@Money",SqlDbType.Decimal,50,values.Float.Money),
                 db.MakeInParam("@DeductWei",SqlDbType.Decimal,50,values.Float.DeductWei),
                 db.MakeInParam("@DeductRate",SqlDbType.Decimal,50,values.Float.DeductRate),
                 db.MakeInParam("@Impurity",SqlDbType.Decimal,50,values.Float.Impurity),
                 db.MakeInParam("@ImpurityRate",SqlDbType.Decimal,50,values.Float.ImpurityRate),
                 db.MakeInParam("@G_Oper",SqlDbType.VarChar,50,WSV.Model.User.LUser.Code),
               db.MakeInParam("@Accepter",SqlDbType.VarChar,50,WSV.Model.User.CUser.Code),
                 db.MakeInParam("@State",SqlDbType.Bit,1,1),
                 db.MakeInParam("@Plan_Code",SqlDbType.VarChar,50,values.Txt.Plan_Code)
             };
         try
         {
             db.TransactSql(visitor, Sql, prams);
         }
         catch (Exception err)
         {
             db.Dispose();
             MessageBox.Show("���ݲ�ȫ��", "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         finally
         {
             db.Dispose();
         }
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// ��������ͼ
 /// </summary>
 /// <param name="CurveFlag"></param>
 /// <param name="CurveCode"></param>
 /// <param name="values"></param>
 public static void Save_Curve(string CurveFlag, string CurveCode, WeightModel values)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     SqlParameter[] prams = new SqlParameter[2];
     prams[0] = db.MakeInParam("@Code", SqlDbType.VarChar, 50, CurveCode);
     if (values.StateFun.Curve != null)
         prams[1] = db.MakeInParam("@Curve", SqlDbType.Binary, values.StateFun.Curve.Length, values.StateFun.Curve);
     else
         prams[1] = db.MakeInParam("@Curve", SqlDbType.Binary, 0, DBNull.Value);
     try
     {
         db.TransactSql(visitor, CurveFlag, prams);
     }
     catch (Exception err)
     {
         db.Dispose();
         MessageBox.Show("����" + err.Message, "������Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 10
0
 public static void SaveCard(string sql, WeightModel values)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     if (sql == "one")
     {
         SqlParameter[] prams ={
                 db.MakeInParam("@ID", SqlDbType.BigInt,50, PublicFun.PublicFun.MaxId("D_Saver")),
                 db.MakeInParam("@Code", SqlDbType.VarChar,50, values.Code),
                 db.MakeInParam("@Card",SqlDbType.VarChar,50,values.Txt.Card),
                 db.MakeInParam("@CarCode", SqlDbType.VarChar,50, values.Txt.CarCode),
                 db.MakeInParam("@Type", SqlDbType.VarChar,50, values.Txt.Type),
                 db.MakeInParam("@Item", SqlDbType.VarChar,50, values.Txt.Item),
                 db.MakeInParam("@Specs", SqlDbType.VarChar,50, values.Txt.Specs),
                 db.MakeInParam("@Place", SqlDbType.VarChar,50, values.Txt.Place),
                 db.MakeInParam("@Send", SqlDbType.VarChar,50, values.Txt.Send),
                 db.MakeInParam("@Accept", SqlDbType.VarChar,50, values.Txt.Accept),
                 db.MakeInParam("@Carry", SqlDbType.VarChar,50, values.Txt.Carry),
                 db.MakeInParam("@Model", SqlDbType.VarChar,50,values.Txt.Model),
                 db.MakeInParam("@Driver", SqlDbType.VarChar,50, values.Txt.Driver),
                 db.MakeInParam("@Spare", SqlDbType.VarChar,50, values.Txt.Spare),
                 db.MakeInParam("@Gross", SqlDbType.Decimal,50, values.Float.Gross),
                 db.MakeInParam("@G_Time",SqlDbType.VarChar,50,values.StateFun.G_Time),
                 db.MakeInParam("@G_Oper",SqlDbType.VarChar,50,WSV.Model.User.LUser.Code),
     };
         try
         {
             db.TransactSql(visitor, sql, prams);
         }
         catch (Exception er)
         {
             MessageBox.Show(er.Message, "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else if (sql == "two")
     {
         SqlParameter[] prams ={
                 db.MakeInParam("@Code", SqlDbType.VarChar,50, values.Code),
                 db.MakeInParam("@CarCode", SqlDbType.VarChar,50, values.Txt.CarCode),
                 db.MakeInParam("@Type", SqlDbType.VarChar,50, values.Txt.Type),
                 db.MakeInParam("@Item", SqlDbType.VarChar,50, values.Txt.Item),
                 db.MakeInParam("@Specs", SqlDbType.VarChar,50, values.Txt.Specs),
                 db.MakeInParam("@Place", SqlDbType.VarChar,50, values.Txt.Place),
                 db.MakeInParam("@Send", SqlDbType.VarChar,50, values.Txt.Send),
                 db.MakeInParam("@Accept", SqlDbType.VarChar,50, values.Txt.Accept),
                 db.MakeInParam("@Carry", SqlDbType.VarChar,50, values.Txt.Carry),
                 db.MakeInParam("@Gross", SqlDbType.Decimal,50, values.Float.Gross),
                 db.MakeInParam("@G_Time",SqlDbType.VarChar,50,values.StateFun.G_Time),
                 db.MakeInParam("@Tare", SqlDbType.Decimal,50, values.Float.Tare),
                 db.MakeInParam("@T_Time",SqlDbType.VarChar,50,values.StateFun.T_Time),
                 db.MakeInParam("@Net",SqlDbType.Decimal,50,values.Float.Net),
                 db.MakeInParam("@N_Time",SqlDbType.VarChar,50,values.StateFun.N_Time),
                 //db.MakeInParam("@G_Oper",SqlDbType.VarChar,50,values.StateFun.G_Oper),
                 db.MakeInParam("@T_Oper",SqlDbType.VarChar,50,values.StateFun.T_Oper),
                 db.MakeInParam("@State",SqlDbType.Bit,1,1)
     };
         try
         {
             db.TransactSql(visitor, sql, prams);
         }
         catch (Exception er)
         {
             MessageBox.Show(er.Message, "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// ������־
 /// </summary>
 /// <param name="values">�����ռ�</param>
 /// <param name="Weight">����</param>
 /// <param name="Time">����ʱ��</param>
 public void WeightLog(WeightModel values, float Weight, string Time)
 {
     bool Enable = bool.Parse(inout.IniReadValue("IdCard", "Enable"));
     string Ip = WSV.Model.User.LUser.Ip;
     string TableNum = WSV.Model.User.LUser.TableNum;
     long OperCode = WSV.Model.User.LUser.Id;
     string Code = WeightLog();
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     SqlParameter[] prams = new SqlParameter[12];
     prams[0] = db.MakeInParam("@ID", SqlDbType.BigInt, 50, values.ID);
     prams[1] = db.MakeInParam("@Code", SqlDbType.VarChar, 50, Code);
     prams[2] = db.MakeInParam("@OperCode", SqlDbType.VarChar, 50, OperCode);
     prams[3] = db.MakeInParam("@Weight", SqlDbType.VarChar, 50, Weight);
     prams[4] = db.MakeInParam("@Time", SqlDbType.VarChar, 50, Time);
     prams[5] = db.MakeInParam("@Ip", SqlDbType.VarChar, 50, Ip);
     prams[6] = db.MakeInParam("@TableNum", SqlDbType.VarChar, 50, TableNum);
     if (values.StateFun.Image1 != null)
         prams[7] = db.MakeInParam("@Image1", SqlDbType.Binary, values.StateFun.Image1.Length, values.StateFun.Image1);
     else
         prams[7] = db.MakeInParam("@Image1", SqlDbType.Binary, 0, DBNull.Value);
     if (values.StateFun.Image2 != null)
         prams[8] = db.MakeInParam("@Image2", SqlDbType.Binary, values.StateFun.Image2.Length, values.StateFun.Image2);
     else
         prams[8] = db.MakeInParam("@Image2", SqlDbType.Binary, 0, DBNull.Value);
     if (values.StateFun.Image3 != null)
         prams[9] = db.MakeInParam("@Image3", SqlDbType.Binary, values.StateFun.Image3.Length, values.StateFun.Image3);
     else
         prams[9] = db.MakeInParam("@Image3", SqlDbType.Binary, 0, DBNull.Value);
     if (values.StateFun.Image4 != null)
         prams[10] = db.MakeInParam("@Image4", SqlDbType.Binary, values.StateFun.Image4.Length, values.StateFun.Image4);
     else
         prams[10] = db.MakeInParam("@Image4", SqlDbType.Binary, 0, DBNull.Value);
     if (values.StateFun.Curve != null)
         prams[11] = db.MakeInParam("@Curve", SqlDbType.Binary, values.StateFun.Curve.Length, values.StateFun.Curve);
     else
         prams[11] = db.MakeInParam("@Curve", SqlDbType.Binary, 0, DBNull.Value);
     try
     {
         db.TransactSql(visitor, "WeightLog", prams);
     }
     catch (Exception err)
     {
         db.Dispose();
         MessageBox.Show(err.Message, "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     finally
     {
         db.Dispose();
     }
 }
Exemplo n.º 12
0
 public static string ShowImage(WeightModel values)
 {
     DataBase db = new DataBase();
     SqlDataReader dr = null;
     string _MaxCode = MaxCode();
     string flag = SelectWeight(_MaxCode);
     string sql = "select G_Image1,G_Image2,G_Image3,G_Image4,T_Image1,T_Image2,T_Image3,T_Image4 from D_Saver_Image where Code=" + _MaxCode;
     db.GetDataReader(out dr, sql);
     try
     {
         if (dr.Read())
         {
             if (flag == "G")
             {
                 if (dr["G_Image1"] != System.DBNull.Value)
                     values.StateFun.G_Image1 = (byte[])dr["G_Image1"];
                 if (dr["G_Image2"] != System.DBNull.Value)
                     values.StateFun.G_Image2 = (byte[])dr["G_Image2"];
                 if (dr["G_Image3"] != System.DBNull.Value)
                     values.StateFun.G_Image3 = (byte[])dr["G_Image3"];
                 if (dr["G_Image4"] != System.DBNull.Value)
                     values.StateFun.G_Image4 = (byte[])dr["G_Image4"];
             }
             else if (flag == "T")
             {
                 if (dr["T_Image1"] != System.DBNull.Value)
                     values.StateFun.T_Image1 = (byte[])dr["T_Image1"];
                 if (dr["T_Image2"] != System.DBNull.Value)
                     values.StateFun.T_Image2 = (byte[])dr["T_Image2"];
                 if (dr["T_Image3"] != System.DBNull.Value)
                     values.StateFun.T_Image3 = (byte[])dr["T_Image3"];
                 if (dr["T_Image4"] != System.DBNull.Value)
                     values.StateFun.T_Image4 = (byte[])dr["T_Image4"];
             }
         }
     }
     catch (Exception err)
     {
         db.Dispose();
         return null;
         MessageBox.Show("����û��ͼƬ��", "������ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     db.Dispose();
     return flag;
 }
Exemplo n.º 13
0
 /// <summary>
 /// ��ʾͼƬ
 /// </summary>
 /// <param name="Code"></param>
 /// <param name="values"></param>
 /// <returns></returns>
 public static bool SelectImage(string Code, WeightModel values, string flag)
 {
     bool retvalues = true;
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WeightDAL();
     SqlParameter[] prams ={
         db.MakeInParam("@Code",SqlDbType.VarChar,50,Code)
     };
     SqlDataReader getReader = null;
     try
     {
         db.GetDataReader(visitor, prams, out getReader, "SelectCode");
         if (getReader.Read())
         {
             if (flag == "M")
             {
                 if (getReader["G_Image1"] != System.DBNull.Value)
                     values.StateFun.G_Image1 = (byte[])getReader["G_Image1"];
                 if (getReader["G_Image2"] != System.DBNull.Value)
                     values.StateFun.G_Image2 = (byte[])getReader["G_Image2"];
                 if (getReader["G_Image3"] != System.DBNull.Value)
                     values.StateFun.G_Image3 = (byte[])getReader["G_Image3"];
                 if (getReader["G_Image4"] != System.DBNull.Value)
                     values.StateFun.G_Image4 = (byte[])getReader["G_Image4"];
                 if (getReader["G_Curve"] != System.DBNull.Value)
                     values.StateFun.G_Curve = (byte[])getReader["G_Curve"];
             }
             else if (flag == "P")
             {
                 if (getReader["T_Image1"] != System.DBNull.Value)
                     values.StateFun.T_Image1 = (byte[])getReader["T_Image1"];
                 if (getReader["T_Image1"] != System.DBNull.Value)
                     values.StateFun.T_Image2 = (byte[])getReader["T_Image2"];
                 if (getReader["T_Image1"] != System.DBNull.Value)
                     values.StateFun.T_Image3 = (byte[])getReader["T_Image3"];
                 if (getReader["T_Image1"] != System.DBNull.Value)
                     values.StateFun.T_Image4 = (byte[])getReader["T_Image4"];
                 if (getReader["T_Curve"] != System.DBNull.Value)
                     values.StateFun.T_Curve = (byte[])getReader["T_Curve"];
             }
         }
         else
         {
             return false;
         }
         getReader.Close();
     }
     catch (Exception err)
     {
         db.Dispose();
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalues;
 }
Exemplo n.º 14
0
 // �����ѯ��ʱ����
 public static bool SelectCard1(string Card, WeightModel Item)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.CardDAL();
     SqlParameter[] prams ={
         db.MakeInParam("@Card",SqlDbType.VarChar,50,Card)
     };
     SqlDataReader getReader = null;
     try
     {
         db.GetDataReader(visitor, prams, out getReader, "SelectCard1");
         if (getReader.Read())
         {
             // Item.Txt.Card = getReader["Card"].ToString();
             Item.Txt.Type = getReader["Type"].ToString();
             Item.Code = getReader["Code"].ToString();
             Item.Txt.CarCode = getReader["CarCode"].ToString();
             Item.Txt.Item = getReader["Item"].ToString();
             Item.Txt.Specs = getReader["Specs"].ToString();
             Item.Txt.Place = getReader["Place"].ToString();
             Item.Txt.Accept = getReader["Accept"].ToString();
             Item.Txt.Send = getReader["Send"].ToString();
             Item.Txt.Carry = getReader["Carry"].ToString();
             Item.StateFun.G_Oper = getReader["G_Oper"].ToString();
             Item.StateFun.G_Time = getReader["G_Time"].ToString();
             Item.Float.Gross = Convert.ToDecimal(getReader["Gross"].ToString());
         }
         else
         {
             return false;
         }
     }
     catch (Exception er)
     {
         db.Dispose();
         MessageBox.Show("���ݴ��������������ݣ�", "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return true;
 }
Exemplo n.º 15
0
 public static bool Update(WeightModel Values)
 {
     bool retvalue = true;
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new CardDAL();
     SqlParameter[] prams ={
         db.MakeInParam("@Card",SqlDbType.VarChar,50,Values.Txt.Card),
         db.MakeInParam("@CarCode",SqlDbType.VarChar,50,Values.Txt.CarCode),
         db.MakeInParam("@Type",SqlDbType.VarChar,50,Values.Txt.Type),
         db.MakeInParam("@Item",SqlDbType.VarChar,50,Values.Txt.Item),
         db.MakeInParam("@Specs",SqlDbType.VarChar,50,Values.Txt.Specs),
         db.MakeInParam("@Place",SqlDbType.VarChar,50,Values.Txt.Place),
         db.MakeInParam("@Send",SqlDbType.VarChar,50,Values.Txt.Send),
         db.MakeInParam("@Accept",SqlDbType.VarChar,50,Values.Txt.Accept),
         db.MakeInParam("@Carry",SqlDbType.VarChar,50,Values.Txt.Carry),
         db.MakeInParam("@Model",SqlDbType.VarChar,50,Values.Txt.Model),
         db.MakeInParam("@Driver",SqlDbType.VarChar,50,Values.Txt.Driver),
         db.MakeInParam("@Spare",SqlDbType.VarChar,50,Values.Txt.Spare),
         db.MakeInParam("@Tare",SqlDbType.Float,50,Values.Float.Tare),
         db.MakeInParam("@State",SqlDbType.Bit,1,Values.StateFun.State)
             };
     try
     {
         db.TransactSql(visitor, "Update_Card", prams);
     }
     catch (Exception err)
     {
         db.Dispose();
         MessageBox.Show(err.Message, "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalue;
 }