示例#1
0
 /// <summary>
 /// ���������
 /// </summary>
 /// <param name="s_Pr"></param>
 /// <returns></returns>
 public static string Data_Add(string s_Pr)
 {
     string CodeA = "";
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     SqlParameter[] prams ={
         db.MakeInParam("@Flag", SqlDbType.VarChar,50,s_Pr)
     };
     SqlDataReader dr = null;
     try
     {
         db.GetDataReader(visitor, prams, out dr, "D_Add");
         if (dr.Read())
         {
             CodeA = dr["Code"].ToString();
         }
         dr.Close();
     }
     catch (Exception ex)
     { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     return CodeA;
 }
示例#2
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;
 }
示例#3
0
 /// <summary>
 /// ���ݲ���
 /// </summary>
 /// <param name="s_Pr"></param>
 /// <returns></returns>
 public static DataSet Data_Operate(string s_Pr)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     SqlParameter[] prams ={
         db.MakeInParam("@Flag", SqlDbType.VarChar,50,s_Pr)
     };
     DataSet ds = new DataSet();
     try
     {
         ds = db.ReturnDataSet(visitor, prams, "D_Operate", "V_D_Base");
     }
     catch (Exception ex)
     { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     return ds;
 }
示例#4
0
 /// <summary>
 /// ��ʾ��ʱ����
 /// </summary>
 /// <returns></returns>
 public static DataSet SelectALL()
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     DataSet ds = new DataSet();
     try
     {
         ds = db.ReturnDataSet(visitor, "SelectALL", "V_D_Saver_Temp");
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
         db.Dispose();
     }
     return ds;
 }
示例#5
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();
            }
        }
示例#6
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();
         }
     }
 }
示例#7
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);
         }
     }
 }
示例#8
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();
     }
 }
示例#9
0
 //�õ��Ƿ����ֶ�
 /// <summary>
 /// ˢ��ʱ�Ƿ����ֶ�
 /// </summary>
 /// <param name="S_Pr"></param>
 /// <returns></returns>
 public bool retretainflag(string S_Pr)
 {
     bool retvalue = false;
     SqlDataReader getReader = null;
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     DataBase db = new DataBase();
     SqlParameter[] prams ={
         db.MakeInParam ("@name",SqlDbType.VarChar,50,S_Pr.Substring(4))
     };
     DataSet ds = new DataSet();
     try
     {
         db.GetDataReader(visitor, prams, out getReader, "Retain");
         if (getReader.Read())
         {
             if (getReader[0].ToString() == "True")
                 retvalue = true;
             else if (getReader[0].ToString() == "False")
                 retvalue = false;
         }
         else
         {
             retvalue = false;
         }
         getReader.Close();
     }
     catch (Exception err)
     {
         db.Dispose();
         throw err;
         return false;
     }
     finally
     {
         if (getReader != null) getReader.Close();
         db.Dispose();
     }
     return retvalue;
 }
示例#10
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();
     }
 }
示例#11
0
 /// <summary>
 /// ����SQL�ַ���
 /// </summary>
 /// <returns></returns>
 public static string W_Char()
 {
     string field = "";
     DataBase db = new DataBase();
     SqlDataReader oddr = null;
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     SqlParameter[] prams ={
         db.MakeInParam("@Flag", SqlDbType.VarChar,50," ")
     };
     db.GetDataReader(visitor, prams, out oddr, "GridViewName");
     while (oddr.Read())
     {
         field += ",[" + oddr["DBName"] + "]";
     }
     if (!string.IsNullOrEmpty(field)) { field = field.Substring(1); }
     return field;
 }
示例#12
0
        /// <summary>
        /// ������Ƶ
        /// </summary>
        /// <param name="card"></param>
        /// <param name="table"></param>
        /// <param name="Values"></param>
        public static void setvideo(int card, string table, Model.Weight.WeightModel Values)
        {
            SqlDataReader getReader = null;
            DataBase db = new DataBase();
            DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
            SqlParameter[] prams = new SqlParameter[2];
            try
            {
                prams[0] = db.MakeInParam("@VIDEO_name", SqlDbType.VarChar, 50, card.ToString());
                prams[1] = db.MakeInParam("@VIDEO_table", SqlDbType.VarChar, 50, table);
                db.GetDataReader(visitor, prams, out getReader, "retvideo");
                if (getReader.Read())
                {
                    BLL.Weight.VideoInfo.VCStream_VCASetVidDeviceColor(card, 0, int.Parse(getReader["VIDEO_Brightness"].ToString()));
                    BLL.Weight.VideoInfo.VCStream_VCASetVidDeviceColor(card, 1, int.Parse(getReader["VIDEO_Contrast"].ToString()));
                    BLL.Weight.VideoInfo.VCStream_VCASetVidDeviceColor(card, 3, int.Parse(getReader["VIDEO_Hue"].ToString()));
                    BLL.Weight.VideoInfo.VCStream_VCASetVidDeviceColor(card, 2, int.Parse(getReader["VIDEO_Saturation"].ToString()));
                    switch (card)
                    {
                        case 0:
                            Values.StateFun.imagesuality1 = int.Parse(getReader["VIDEO_Suality"].ToString());
                            break;
                        case 1:
                            Values.StateFun.imagesuality2 = int.Parse(getReader["VIDEO_Suality"].ToString());
                            break;
                        case 2:
                            Values.StateFun.imagesuality3 = int.Parse(getReader["VIDEO_Suality"].ToString());
                            break;
                        case 3:
                            Values.StateFun.imagesuality4 = int.Parse(getReader["VIDEO_Suality"].ToString());
                            break;
                    }
                }
                else
                {
                    BLL.Weight.VideoInfo.VCStream_VCASetVidDeviceColor(card, 0, 80);
                    BLL.Weight.VideoInfo.VCStream_VCASetVidDeviceColor(card, 1, 44);
                    BLL.Weight.VideoInfo.VCStream_VCASetVidDeviceColor(card, 2, 40);
                    BLL.Weight.VideoInfo.VCStream_VCASetVidDeviceColor(card, 3, 0);
                    switch (card)
                    {
                        case 0:
                            Values.StateFun.imagesuality1 = 80;
                            break;
                        case 1:
                            Values.StateFun.imagesuality2 = 80;
                            break;
                        case 2:
                            Values.StateFun.imagesuality3 = 80;
                            break;
                        case 3:
                            Values.StateFun.imagesuality4 = 80;
                            break;
                    }
                }
                getReader.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show("����" + err.Message, "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {

            }
        }
示例#13
0
 /// <summary>
 /// �������
 /// </summary>
 /// <returns></returns>
 public static DataSet SelectType()
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WeightDAL();
     DataSet ds = new DataSet();
     try
     {
         ds = db.ReturnDataSet(visitor, "SelectType", "D_Type");
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         db.Dispose();
     }
     return ds;
 }
示例#14
0
 /// <summary>
 /// ��ѯ���ŵ�ǰ״̬
 /// </summary>
 /// <param name="a"></param>
 /// <returns></returns>
 public static bool SelectState(string a)
 {
     bool retvalue;
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WeightDAL();
     SqlParameter[] prams ={
         db.MakeInParam("@Card",SqlDbType.VarChar,50,a)
     };
     SqlDataReader getreader = null;
     db.GetDataReader(visitor, prams, out getreader, "SelectState");
     try
     {
         if (getreader.Read())
         {
             retvalue = Convert.ToBoolean(getreader["State"]);
         }
         else
         {
             return retvalue = false;
         }
         getreader.Close();
     }
     catch (Exception e)
     {
         db.Dispose();
         MessageBox.Show("û�д˿��ţ�", "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalue;
 }
示例#15
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;
 }