Beispiel #1
0
 /// <summary>
 /// summary>
 /// 按条件查询信息SmsSend
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <SmsSend> Query(Expression <Func <SmsSend, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.SmsSend.Where(fun).ToList());
     }
 }
Beispiel #2
0
 /// <summary>
 /// summary>
 /// 按条件查询信息LogInfo
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <LogInfo> Query(Expression <Func <LogInfo, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.LogInfo.Where(fun).ToList());
     }
 }
Beispiel #3
0
 /// <summary>
 /// summary>
 /// 按条件查询信息View_LogInfo_Dictionary
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <View_LogInfo_Dictionary> QueryView_LogInfo_Dictionary(Expression <Func <View_LogInfo_Dictionary, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.View_LogInfo_Dictionary.Where(fun).ToList());
     }
 }
 /// <summary>
 /// summary>
 /// 按条件查询信息View_Menu_ControlRole
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <View_Menu_ControlRole> QueryView_Menu_ControlRole(Expression <Func <View_Menu_ControlRole, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.View_Menu_ControlRole.Where(fun).ToList());
     }
 }
Beispiel #5
0
        /// <summary>
        /// LINQ更新方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dc"></param>
        /// <param name="fun"></param>
        /// <param name="tentity"></param>
        /// <param name="action"></param>
        public static bool Update(Expression <Func <LogInfo, bool> > fun, Action <LogInfo> action)
        {
            bool rbool = true;
            DCQUALITYDataContext dc = new DCQUALITYDataContext();

            try
            {
                var table = dc.LogInfo.Where(fun).ToList();
                foreach (var item in table)
                {
                    action(item);
                }
                dc.SubmitChanges();
            }
            catch
            {
                dc.ChangeConflicts.ResolveAll(RefreshMode.KeepCurrentValues);
                dc.SubmitChanges();
                rbool = false;
            }
            finally
            {
                dc.Connection.Close();
            }
            return(rbool);
        }
 /// <summary>
 /// 查询所有信息
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <Unusualstandard> Query()
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.Unusualstandard.ToList());
     }
 }
 /// <summary>
 /// 查询单条 返回实体
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="fun"></param>
 /// <returns></returns>
 public static Unusualstandard Single(Expression <Func <Unusualstandard, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.Unusualstandard.SingleOrDefault(fun));
     }
 }
 /// <summary>
 /// 查询单条 返回实体
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="fun"></param>
 /// <returns></returns>
 public static Packets Single(Expression <Func <Packets, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.Packets.SingleOrDefault(fun));
     }
 }
Beispiel #9
0
 public static List <Dictionary> GetListDictionary()
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.Dictionary.ToList());
     }
 }
 {   /// <summary>
     /// 查询所有信息
     /// </summary>
     /// <returns></returns>
     public static IEnumerable <Packets> Query()
     {
         using (DCQUALITYDataContext db = new DCQUALITYDataContext())
         {
             return(db.Packets.ToList());
         }
     }
 /// <summary>
 /// summary>
 /// 按条件查询信息Packets
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <Packets> Query(Expression <Func <Packets, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.Packets.Where(fun).ToList());
     }
 }
Beispiel #12
0
 /// <summary>
 /// 查询所有信息
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <DRAW_EXAM_INTERFACE> Query(Expression <Func <DRAW_EXAM_INTERFACE, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.DRAW_EXAM_INTERFACE.Where(fun).ToList());
     }
 }
Beispiel #13
0
 /// <summary>
 /// summary>
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <View_Collection> Query(Expression <Func <View_Collection, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.View_Collection.Where(fun).ToList());
     }
 }
Beispiel #14
0
 /// <summary>
 /// 查询单条 返回实体
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="fun"></param>
 /// <returns></returns>
 public static SmsSend Single(Expression <Func <SmsSend, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.SmsSend.SingleOrDefault(fun));
     }
 }
 /// <summary>
 /// 查询单条 返回实体
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="fun"></param>
 /// <returns></returns>
 public static WaterTestConfigureSet Single(Expression <Func <WaterTestConfigureSet, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.WaterTestConfigureSet.SingleOrDefault(fun));
     }
 }
Beispiel #16
0
        /// <summary>
        /// 根据启动状态和字典值获取字典信息
        /// </summary>
        /// <param name="strValue">字典值</param>
        /// <returns></returns>
        public static List <Dictionary> GetValueStateDictionary(string strValue)
        {
            List <Dictionary> list = new List <Dictionary>();

            using (DCQUALITYDataContext db = new DCQUALITYDataContext())
            {
                try
                {
                    int itemid = db.Dictionary.First(d => (d.Dictionary_Value == strValue && d.Dictionary_State == true)).Dictionary_ID;

                    var v = (from c in db.Dictionary
                             where (c.Dictionary_ID == itemid || c.Dictionary_OtherID.Value == itemid) && c.Dictionary_State == true
                             select c.Dictionary_ID).ToArray();
                    list = (from c in db.Dictionary
                            where c.Dictionary_State == true && v.Contains(c.Dictionary_OtherID.Value)
                            select c).ToList();
                    Dictionary dic = new Dictionary();
                    dic.Dictionary_ID   = 0;
                    dic.Dictionary_Name = "全部";
                    list.Add(dic);
                }
                catch (Exception ex)
                {
                }
                finally { db.Connection.Close(); }
            }
            return(list);
        }
        /// <summary>
        /// 修改客户端信息
        /// 注意:请在编写实体之前先获取实体再进行修改的字段编写
        /// </summary>
        /// <param name="record">客户端实体(ClientInfo)</param>
        /// <returns></returns>
        public static bool UpdateOneQcRecord(ClientInfo client)
        {
            bool rbool = false;

            using (DCQUALITYDataContext db = new DCQUALITYDataContext())
            {
                try
                {
                    ClientInfo qInfo = db.ClientInfo.First(c => c.Client_ID == client.Client_ID);
                    qInfo.Client_ADDRESS       = client.Client_ADDRESS;
                    qInfo.Client_Dictionary_ID = client.Client_Dictionary_ID;
                    qInfo.Client_NAME          = client.Client_NAME;
                    qInfo.Client_Phone         = client.Client_Phone;
                    qInfo.Client_REMARK        = client.Client_REMARK;
                    qInfo.Client_TestItems_ID  = client.Client_TestItems_ID;
                    db.SubmitChanges();
                    rbool = true;
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    db.Connection.Close();
                }
            }

            return(rbool);
        }
Beispiel #18
0
        /// <summary>
        /// 多项更改
        /// 使用SubmitChanges将对检索到的进行的更新保持回数据库
        /// </summary>
        /// <param name="dictionary">Dictionary实体对象</param>
        /// <returns></returns>
        public static bool UpdateMore(Dictionary dictionary)
        {
            bool rbool = true;

            try
            {
                using (DCQUALITYDataContext db = new DCQUALITYDataContext())
                {
                    var q = from p in db.Dictionary
                            where p.Dictionary_ID == dictionary.Dictionary_ID
                            select p;
                    foreach (var p in q)
                    {
                        p.Dictionary_Name    = dictionary.Dictionary_Name;
                        p.Dictionary_OtherID = dictionary.Dictionary_OtherID;
                        p.Dictionary_Remark  = dictionary.Dictionary_Remark;
                        p.Dictionary_State   = dictionary.Dictionary_State;
                        p.Dictionary_Value   = dictionary.Dictionary_Value;
                    }
                    db.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                rbool = false;
            }
            return(rbool);
        }
 /// <summary>
 /// summary>
 /// 按条件查询信息Unusualstandard
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <Unusualstandard> Query(Expression <Func <Unusualstandard, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.Unusualstandard.Where(fun).ToList());
     }
 }
 /// <summary>
 /// 查询所有信息
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <Beonduty> Query()
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.Beonduty.ToList());
     }
 }
 /// <summary>
 /// 查询所有信息View_Menu_ControlRole
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <View_Menu_ControlRole> QueryView_Menu_ControlRole()
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.View_Menu_ControlRole.ToList());
     }
 }
 /// <summary>
 /// 查询单条 返回实体
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="fun"></param>
 /// <returns></returns>
 public static Beonduty Single(Expression <Func <Beonduty, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.Beonduty.SingleOrDefault(fun));
     }
 }
        private void BindState()
        {
            Expression <Func <ClientInfo, bool> > expr = n => n.Client_Dictionary_ID == 2;

            cmbClient.DataSource         = ClientDAL.Query(expr);
            this.cmbClient.DisplayMember = "Client_NAME";
            cmbClient.ValueMember        = "Client_ID";
            if (cmbClient.DataSource != null)
            {
                cmbClient.SelectedIndex = 0;
            }

            DCQUALITYDataContext dc     = new DCQUALITYDataContext();
            List <ClientInfo>    client = new List <ClientInfo>();

            client = (from c in dc.ClientInfo where c.Client_Dictionary_ID == 2 select c).ToList();
            //Expression<Func<ClientInfo, bool>> exp = n => n.Client_Dictionary_ID == 2;
            //var client = ClientDAL.Query(exp);
            ClientInfo dic = new ClientInfo();

            dic.Client_ID   = 0;
            dic.Client_NAME = "全部";
            client.Insert(0, dic);
            cmbSClient.DataSource         = client;
            this.cmbSClient.DisplayMember = "Client_NAME";
            cmbSClient.ValueMember        = "Client_ID";
            if (cmbSClient.DataSource != null)
            {
                cmbSClient.SelectedIndex = 0;
            }
        }
 /// <summary>
 /// 查询所有信息
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <WaterTestConfigureSet> Query()
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.WaterTestConfigureSet.ToList());
     }
 }
Beispiel #25
0
 /// <summary>
 /// 查询所有信息
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <LogInfo> Query()
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.LogInfo.ToList());
     }
 }
 /// <summary>
 /// summary>
 /// 按条件查询信息WaterTestConfigureSet
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <WaterTestConfigureSet> Query(Expression <Func <WaterTestConfigureSet, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.WaterTestConfigureSet.Where(fun).ToList());
     }
 }
Beispiel #27
0
 /// <summary>
 /// 查询所有信息View_LogInfo_Dictionary
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <View_LogInfo_Dictionary> QueryView_LogInfo_Dictionary()
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.View_LogInfo_Dictionary.ToList());
     }
 }
 /// <summary>
 /// summary>
 /// 按条件查询信息View_Beonduty_D_Q
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <View_Beonduty_D_Q> Query(Expression <Func <View_Beonduty_D_Q, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.View_Beonduty_D_Q.Where(fun).ToList());
     }
 }
Beispiel #29
0
 /// <summary>
 /// 查询单条 返回实体
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="fun"></param>
 /// <returns></returns>
 public static LogInfo Single(Expression <Func <LogInfo, bool> > fun)
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.LogInfo.SingleOrDefault(fun));
     }
 }
Beispiel #30
0
 /// <summary>
 /// 查询所有信息
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <SmsSend> Query()
 {
     using (DCQUALITYDataContext db = new DCQUALITYDataContext())
     {
         return(db.SmsSend.ToList());
     }
 }