Exemplo n.º 1
0
        /// <summary>
        /// 创建一个人员
        /// </summary>
        /// <param name="validationErrors">返回的错误信息</param>
        /// <param name="db">数据库上下文</param>
        /// <param name="entity">一个人员</param>
        /// <returns></returns>
        public bool Create(ref ValidationErrors validationErrors, SysEntities db, SysPerson entity)
        {
            int count = 1;

            foreach (string item in entity.SysRoleId.GetIdSort())
            {
                SysRole sys = new SysRole { Id = item };
                db.SysRole.Attach(sys);
                entity.SysRole.Add(sys);
                count++;
            }

            foreach (string item in entity.SysDocumentId.GetIdSort())
            {
                SysDocument sys = new SysDocument { Id = item };
                db.SysDocument.Attach(sys);
                entity.SysDocument.Add(sys);
                count++;
            }

            repository.Create(db, entity);
            if (count == repository.Save(db))
            {
                return true;
            }
            else
            {
                validationErrors.Add("创建出错了");
            }
            return false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建一个菜单
        /// </summary>
        /// <param name="validationErrors">返回的错误信息</param>
        /// <param name="db">数据库上下文</param>
        /// <param name="entity">一个菜单</param>
        /// <returns></returns>
        public bool Create(ref ValidationErrors validationErrors, SysEntities db, SysMenu entity)
        {
            int count = 1;

            foreach (string item in entity.SysOperationId.GetIdSort())
            {
                SysOperation sys = new SysOperation { Id = item };
                db.SysOperation.Attach(sys);
                entity.SysOperation.Add(sys);
                count++;
            }

            repository.Create(db, entity);
            if (count == repository.Save(db))
            {
                //创建后重置菜单编码
                List<int> flags = new List<int>();//层级
                GetMenus2(null, flags);
                db.SaveChanges();
                return true;
            }
            else
            {
                validationErrors.Add("创建出错了");
            }
            return false;
        }
Exemplo n.º 3
0
 public SysAnnouncement GetTop(int num)
 {
     using (SysEntities db = new SysEntities())
     {
         return db.SysAnnouncement.Where(w=>w.State=="开启").OrderBy(o => o.CreateTime).Take(num).SingleOrDefault();
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 验证用户名和密码是否正确
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>登录成功后的用户信息</returns>
        public SysPerson ValidateUser(string userName, string password)
        {
            if (String.IsNullOrWhiteSpace(userName) || String.IsNullOrWhiteSpace(password))
                return null;

            //获取用户信息,请确定web.config中的连接字符串正确
            using (SysEntities db = new SysEntities())
            {
                var person = (from p in db.SysPerson
                              where p.Name == userName
                              && p.Password == password
                              && p.State == "开启"
                              select p).FirstOrDefault();
                if (person != null)
                {//登录成功
                    person.LastLogonTime = person.LogonTime;
                    person.LastLogonIP = person.LogonIP;
                    person.LogonNum++;
                    person.LogonTime = DateTime.Now;
                    person.LogonIP = Common.IP.GetIP();
                    db.SaveChanges();
                    return person;
                }

            } return null;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="personName">用户名</param>
        /// <param name="oldPassword">旧密码</param>
        /// <param name="newPassword">新密码</param>
        /// <returns>修改密码是否成功</returns>
        public bool ChangePassword(string personName, string oldPassword, string newPassword)
        {
            if (!string.IsNullOrWhiteSpace(personName) && !string.IsNullOrWhiteSpace(oldPassword) && !string.IsNullOrWhiteSpace(newPassword))
            {
                try
                {
                 string   oldPasswordEncryptString = EncryptAndDecrypte.EncryptString(oldPassword);
                string    newPasswordEncryptString = EncryptAndDecrypte.EncryptString(newPassword);

                    using (SysEntities db = new SysEntities())
                    {
                        var person = db.SysPerson.FirstOrDefault(p => (p.Name == personName) && (p.Password == oldPasswordEncryptString));
                        person.Password = newPasswordEncryptString;
                        person.SurePassword = newPasswordEncryptString;
                        if (!string.IsNullOrWhiteSpace(person.EmailAddress))
                        {
                            NetSendMail.MailSendChangePassword(db, person.EmailAddress, personName, newPassword);
                            //发送通知的邮件

                        }

                        db.SaveChanges();
                        return true;
                    }
                }
                catch (Exception ex)
                {
                    ExceptionsHander.WriteExceptions(ex);
                }

            }
            return false;
        }
 /// <summary>
 /// 根据SysMenuId,获取所有角色菜单操作数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable<SysOperation> GetByRefSysMenuIdAndSysRoleId(SysEntities db, string id, List<string> sysRoleIds)
 {
     //兼容oracle
     return
           ( from o in db.SysOperation
            from m in db.SysMenuSysRoleSysOperation.Where(c => sysRoleIds.Any(a => a == c.SysRoleId) && c.SysMenuId == id && c.SysOperationId != null).Select(s => s.SysOperationId)
            where o.Id == m
            select o).Distinct().OrderBy(o=>o.Sort).AsQueryable()
              ;
 }
Exemplo n.º 7
0
        public static void MailSendChangePassword(SysEntities db, string mailTo, string name, string psw)
        {
            string tempName = "修改密码发送的邮件通知";
            var data = db.SysEmailTemp.Where(w => w.Mail_name == tempName).FirstOrDefault();
            if (data != null)
            {
                SysEmail email = new SysEmail();
                email.CreateTime = DateTime.Now;
                email.Id = Common.Result.GetNewId();
                email.SysMailId = data.Id;
                email.Subject = data.Subject.Replace("{{用户名}}", name).Replace("{{密码}}", psw);
                email.Content = data.Content.Replace("{{用户名}}", name).Replace("{{密码}}", psw);
                email.Mail_type = mailTo;
                email.Reply_email = data.Reply_email;
                db.SysEmail.Add(email);

                string mailFromPwd = "langben123",
                  mailSmtpServer = "smtp.exmail.qq.com";

                SendSMTPEMail(mailSmtpServer, 25, email.Reply_email, "服务", "*****@*****.**", mailFromPwd, mailTo, email.Subject, email.Content);

            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public CompanyBLL(SysEntities entities)
 {
     db = entities;
 }
Exemplo n.º 9
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public FileUploaderBLL(SysEntities entities)
 {
     db = entities;
 }
Exemplo n.º 10
0
 /// <summary>
 /// 通过主键id,获取变送器频率相位---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>变送器频率相位</returns>
 public TRANSMITTER_FREQUENCY_PHASE GetById(SysEntities db, string id)
 {
     return(db.TRANSMITTER_FREQUENCY_PHASE.SingleOrDefault(s => s.ID == id));
 }
Exemplo n.º 11
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public GenZongBLL(SysEntities entities)
 {
     db = entities;
 }
Exemplo n.º 12
0
        /// <summary>
        /// 编辑一个人员
        /// </summary>
        /// <param name="validationErrors">返回的错误信息</param>
        /// <param name="db">数据上下文</param>
        /// <param name="entity">一个人员</param>
        /// <returns>是否编辑成功</returns>
        public bool Edit(ref ValidationErrors validationErrors, SysEntities db, SysPerson entity)
        {
            /*
                           * 不操作 原有 现有
                           * 增加   原没 现有
                           * 删除   原有 现没
                           */
            if (entity == null)
            {
                return false;
            }
            int count = 1;

            List<string> addSysRoleId = new List<string>();
            List<string> deleteSysRoleId = new List<string>();
            DataOfDiffrent.GetDiffrent(entity.SysRoleId.GetIdSort(), entity.SysRoleIdOld.GetIdSort(), ref addSysRoleId, ref deleteSysRoleId);
            List<SysRole> listEntitySysRole = new List<SysRole>();
            if (deleteSysRoleId != null && deleteSysRoleId.Count() > 0)
            {
                foreach (var item in deleteSysRoleId)
                {
                    SysRole sys = new SysRole { Id = item };
                    listEntitySysRole.Add(sys);
                    entity.SysRole.Add(sys);
                }
            }

            List<string> addSysDocumentId = new List<string>();
            List<string> deleteSysDocumentId = new List<string>();
            DataOfDiffrent.GetDiffrent(entity.SysDocumentId.GetIdSort(), entity.SysDocumentIdOld.GetIdSort(), ref addSysDocumentId, ref deleteSysDocumentId);
            List<SysDocument> listEntitySysDocument = new List<SysDocument>();
            if (deleteSysDocumentId != null && deleteSysDocumentId.Count() > 0)
            {
                foreach (var item in deleteSysDocumentId)
                {
                    SysDocument sys = new SysDocument { Id = item };
                    listEntitySysDocument.Add(sys);
                    entity.SysDocument.Add(sys);
                }
            }

            SysPerson editEntity = repository.Edit(db, entity);

            if (addSysRoleId != null && addSysRoleId.Count() > 0)
            {
                foreach (var item in addSysRoleId)
                {
                    SysRole sys = new SysRole { Id = item };
                    db.SysRole.Attach(sys);
                    editEntity.SysRole.Add(sys);
                    count++;
                }
            }
            if (deleteSysRoleId != null && deleteSysRoleId.Count() > 0)
            {
                foreach (SysRole item in listEntitySysRole)
                {
                    editEntity.SysRole.Remove(item);
                    count++;
                }
            }

            if (addSysDocumentId != null && addSysDocumentId.Count() > 0)
            {
                foreach (var item in addSysDocumentId)
                {
                    SysDocument sys = new SysDocument { Id = item };
                    db.SysDocument.Attach(sys);
                    editEntity.SysDocument.Add(sys);
                    count++;
                }
            }
            if (deleteSysDocumentId != null && deleteSysDocumentId.Count() > 0)
            {
                foreach (SysDocument item in listEntitySysDocument)
                {
                    editEntity.SysDocument.Remove(item);
                    count++;
                }
            }

            if (count == repository.Save(db))
            {
                return true;
            }
            else
            {
                validationErrors.Add("编辑人员出错了");
            }
            return false;
        }
Exemplo n.º 13
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public SysEmailBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 14
0
 /// <summary>
 /// 根据PREPARE_SCHEMEID,获取所有标准器选择数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable <STANDARDCHOICE> GetByRefPREPARE_SCHEMEID(SysEntities db, string id)
 {
     return(from c in db.STANDARDCHOICE
            where c.PREPARE_SCHEMEID == id
            select c);
 }
Exemplo n.º 15
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public SysMessageBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 16
0
 /// <summary>
 /// 根据UNDERTAKE_LABORATORYID,获取所有方案数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable <SCHEME> GetByRefUNDERTAKE_LABORATORYID(SysEntities db, string id)
 {
     return(from c in db.SCHEME
            where c.UNDERTAKE_LABORATORYID == id
            select c);
 }
Exemplo n.º 17
0
 /// <summary>
 /// 通过主键id,获取标准器选择---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>标准器选择</returns>
 public STANDARDCHOICE GetById(SysEntities db, string id)
 {
     return(db.STANDARDCHOICE.SingleOrDefault(s => s.ID == id));
 }
Exemplo n.º 18
0
 /// <summary>
 /// 通过主键id,获取方案---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>方案</returns>
 public SCHEME GetById(SysEntities db, string id)
 {
     return(db.SCHEME.SingleOrDefault(s => s.ID == id));
 }
Exemplo n.º 19
0
        /// <summary>
        /// 查询的数据
        /// </summary>
        /// <param name="SysEntities">数据访问的上下文</param>
        /// <param name="order">升序asc(默认)还是降序desc</param>
        /// <param name="sort">排序字段</param>
        /// <param name="search">查询条件</param>
        /// <param name="listQuery">额外的参数</param>
        /// <returns></returns>
        public IQueryable <VRUKU> GetDataX(SysEntities db, string order, string sort, string search, params object[] listQuery)
        {
            string where = string.Empty;
            int      flagWhere = 0;
            string   EQUIPMENT_STATUS_VALUUMN = string.Empty;
            string   REPORTSTATUSZI           = string.Empty;
            DateTime?startTime = null;
            DateTime?endTime   = null;
            Dictionary <string, string> queryDic = ValueConvert.StringToDictionary(search.GetString());

            if (queryDic != null && queryDic.Count > 0)
            {
                foreach (var item in queryDic)
                {
                    if (!string.IsNullOrEmpty(item.Key) && !string.IsNullOrEmpty(item.Value) && item.Key == "EQUIPMENT_STATUS_VALUUMN")
                    {
                        EQUIPMENT_STATUS_VALUUMN = item.Value;
                        continue;
                    }
                    if (!string.IsNullOrEmpty(item.Key) && !string.IsNullOrEmpty(item.Value) && item.Key == "REPORTSTATUSZI")
                    {
                        REPORTSTATUSZI = item.Value;
                        continue;
                    }
                    //oracle数据库使用linq对时间段查询
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(Start_Time)) //开始时间
                    {
                        startTime = Convert.ToDateTime(item.Value);
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(End_Time)) //结束时间+1
                    {
                        endTime = Convert.ToDateTime(item.Value).AddDays(1);
                        continue;
                    }
                    if (flagWhere != 0)
                    {
                        where += " and ";
                    }

                    flagWhere++;

                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(Start_Int)) //开始数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(Start_Int)) + "] >= " + item.Value.GetInt();
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(End_Int)) //结束数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(End_Int)) + "] <= " + item.Value.GetInt();
                        continue;
                    }

                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(DDL_Int)) //精确查询数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(DDL_Int)) + "] =" + item.Value;
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(DDL_String)) //精确查询字符串
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(DDL_String)) + "] = '" + item.Value + "'";
                        continue;
                    }
                    where += "it.[" + item.Key + "] like '%" + item.Value + "%'";//模糊查询
                }
            }
            string[] EQUIPMENT_STATUS_VALUUMNarr = null;
            if (!string.IsNullOrEmpty(EQUIPMENT_STATUS_VALUUMN))
            {
                EQUIPMENT_STATUS_VALUUMNarr = EQUIPMENT_STATUS_VALUUMN.Split('*');
            }
            string[] REPORTSTATUSZIarr = null;
            if (!string.IsNullOrEmpty(REPORTSTATUSZI))
            {
                REPORTSTATUSZIarr = REPORTSTATUSZI.Split('*');
            }
            if (REPORTSTATUSZIarr == null)
            {
                var data = ((System.Data.Entity.Infrastructure.IObjectContextAdapter)db).ObjectContext
                           .CreateObjectSet <VRUKU>().Where(string.IsNullOrEmpty(where) ? "true" : where)
                           .OrderBy("it.[" + sort.GetString() + "] " + order.GetString())
                           //.OrderBy("it.[UPDATETIME] " + "desc")
                           .Where(w => EQUIPMENT_STATUS_VALUUMNarr.Contains(w.EQUIPMENT_STATUS_VALUUMN))
                           .AsQueryable();
                if (null != startTime)
                {
                    data = data.Where(m => startTime <= m.APPROVALDATE);
                }
                if (null != endTime)
                {
                    data = data.Where(m => endTime >= m.APPROVALDATE);
                }
                return(data);
            }
            else
            {
                var data = ((System.Data.Entity.Infrastructure.IObjectContextAdapter)db).ObjectContext
                           .CreateObjectSet <VRUKU>().Where(string.IsNullOrEmpty(where) ? "true" : where)
                           .OrderBy("it.[" + sort.GetString() + "] " + order.GetString())
                           //.OrderBy("it.[UPDATETIME] " + "desc")
                           .Where(w => EQUIPMENT_STATUS_VALUUMNarr.Contains(w.EQUIPMENT_STATUS_VALUUMN) || REPORTSTATUSZIarr.Contains(w.REPORTSTATUSZI))
                           .AsQueryable();
                if (null != startTime)
                {
                    data = data.Where(m => startTime <= m.APPROVALDATE);
                }
                if (null != endTime)
                {
                    data = data.Where(m => endTime >= m.APPROVALDATE);
                }
                return(data);
            }
        }
Exemplo n.º 20
0
 /// <summary>
 /// 根据TRANSMITTER_HEADID,获取所有变送器频率相位数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable <TRANSMITTER_FREQUENCY_PHASE> GetByRefTRANSMITTER_HEADID(SysEntities db, string id)
 {
     return(from c in db.TRANSMITTER_FREQUENCY_PHASE
            where c.TRANSMITTER_HEADID == id
            select c);
 }
Exemplo n.º 21
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public SysFieldBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 22
0
 /// <summary>
 /// 通过主键id,获取客户_企业信息---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>客户_企业信息</returns>
 public CRM_Company GetById(SysEntities db, int id)
 {
     return(db.CRM_Company.SingleOrDefault(s => s.ID == id));
 }
Exemplo n.º 23
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public DepartmentBLL()
 {
     db = new SysEntities();
 }
 /// <summary>
 /// 通过主键id,获取公告管理---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>公告管理</returns>
 public SysAnnouncement GetById(SysEntities db, string id)
 {
     return(db.SysAnnouncement.SingleOrDefault(s => s.Id == id));
 }
Exemplo n.º 25
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public ShenQingBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 26
0
 /// <summary>
 /// 通过主键id,获取客服社保种类---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>客服社保种类</returns>
 public ORG_UserInsuranceKind GetById(SysEntities db, int id)
 {
     return(db.ORG_UserInsuranceKind.SingleOrDefault(s => s.ID == id));
 }
Exemplo n.º 27
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public SysPersonBLL(SysEntities entities)
 {
     db = entities;
 }
Exemplo n.º 28
0
 /// <summary>
 /// 根据InsuranceKindId,获取所有客服社保种类数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable <ORG_UserInsuranceKind> GetByRefInsuranceKindId(SysEntities db, int id)
 {
     return(from c in db.ORG_UserInsuranceKind
            where c.InsuranceKindId == id
            select c);
 }
Exemplo n.º 29
0
 /// <summary>
 /// 通过主键id,获取附件---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>附件</returns>
 public FileUploader GetById(SysEntities db, string id)
 {
     return(db.FileUploader.SingleOrDefault(s => s.Id == id));
 }
Exemplo n.º 30
0
 /// <summary>
 /// 通过主键id,获取客户_企业银行账户_待审核---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>客户_企业银行账户_待审核</returns>
 public CRM_CompanyBankAccount_Audit GetById(SysEntities db, int id)
 {
     return(db.CRM_CompanyBankAccount_Audit.SingleOrDefault(s => s.ID == id));
 }
Exemplo n.º 31
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public GenZongBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 32
0
 /// <summary>
 /// 通过主键id,获取菜单---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>菜单</returns>
 public SysMenu GetById(SysEntities db, string id)
 {
     return(db.SysMenu.SingleOrDefault(s => s.Id == id));
 }
Exemplo n.º 33
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public CompanyBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 34
0
        /// <summary>
        /// 查询的数据
        /// </summary>
        /// <param name="SysEntities">数据访问的上下文</param>
        /// <param name="order">排序字段</param>
        /// <param name="sort">升序asc(默认)还是降序desc</param>
        /// <param name="search">查询条件</param>
        /// <param name="listQuery">额外的参数</param>
        /// <returns></returns>
        public IQueryable <SysMenu> DaoChuData(SysEntities db, string order, string sort, string search, params object[] listQuery)
        {
            string where = string.Empty;
            int flagWhere = 0;

            Dictionary <string, string> queryDic = ValueConvert.StringToDictionary(search.GetString());

            if (queryDic != null && queryDic.Count > 0)
            {
                foreach (var item in queryDic)
                {
                    if (flagWhere != 0)
                    {
                        where += " and ";
                    }
                    flagWhere++;



                    if (queryDic.ContainsKey("SysOperation") && !string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key == "SysOperation")
                    {//查询多对多关系的列名
                        where += "EXISTS(select p from it.SysOperation as p where p.Id='" + item.Value + "')";
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(Start_Time)) //需要查询的列名
                    {
                        where += "it. " + item.Key.Remove(item.Key.IndexOf(Start_Time)) + " >=  CAST('" + item.Value + "' as   System.DateTime)";
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(End_Time))  //需要查询的列名
                    {
                        where += "it." + item.Key.Remove(item.Key.IndexOf(End_Time)) + " <  CAST('" + Convert.ToDateTime(item.Value).AddDays(1) + "' as   System.DateTime)";
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(Start_Int))  //需要查询的列名
                    {
                        where += "it." + item.Key.Remove(item.Key.IndexOf(Start_Int)) + " >= " + item.Value.GetInt();
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(End_Int))  //需要查询的列名
                    {
                        where += "it." + item.Key.Remove(item.Key.IndexOf(End_Int)) + " <= " + item.Value.GetInt();
                        continue;
                    }

                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(End_String))  //需要查询的列名
                    {
                        where += "it." + item.Key.Remove(item.Key.IndexOf(End_String)) + " = '" + item.Value + "'";
                        continue;
                    }

                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(DDL_String))  //需要查询的列名
                    {
                        where += "it." + item.Key.Remove(item.Key.IndexOf(DDL_String)) + " = '" + item.Value + "'";
                        continue;
                    }
                    where += "it." + item.Key + " like '%" + item.Value + "%'";
                }
            }
            return(db.SysMenu
                   .Where(string.IsNullOrEmpty(where) ? "true" : where)
                   .OrderBy("it." + sort.GetString() + " " + order.GetString())
                   .AsQueryable());
        }
Exemplo n.º 35
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public FileUploaderBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 36
0
 /// <summary>
 /// 通过主键id,获取直流电压输出---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>直流电压输出</returns>
 public DC_VOLTAGE_OUTPUT GetById(SysEntities db, string id)
 {
     return(db.DC_VOLTAGE_OUTPUT.SingleOrDefault(s => s.ID == id));
 }
 /// <summary>
 /// 根据ResumeId,获取所有实习经验数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable <InternshipExperience> GetByRefResumeId(SysEntities db, string id)
 {
     return(from c in db.InternshipExperience
            where c.ResumeId == id
            select c);
 }
Exemplo n.º 38
0
 /// <summary>
 /// 根据OVERALL_TABLEID,获取所有直流电压输出数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable <DC_VOLTAGE_OUTPUT> GetByRefOVERALL_TABLEID(SysEntities db, string id)
 {
     return(from c in db.DC_VOLTAGE_OUTPUT
            where c.OVERALL_TABLEID == id
            select c);
 }
Exemplo n.º 39
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public SysFieldBLL(SysEntities entities)
 {
     db = entities;
 }
Exemplo n.º 40
0
 /// <summary>
 /// 通过主键id,获取费用_社保支出医疗大额---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>费用_社保支出医疗大额</returns>
 public COST_PayYiLiaoDaE GetById(SysEntities db, int id)
 {
     return(db.COST_PayYiLiaoDaE.SingleOrDefault(s => s.ID == id));
 }
Exemplo n.º 41
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public DepartmentBLL(SysEntities entities)
 {
     db = entities;
 }
 /// <summary>
 /// 通过主键id,获取不确定度参数管理---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>不确定度参数管理</returns>
 public UNCERTAINTYPARAMETERMANAGEMENT GetById(SysEntities db, string id)
 {
     return(db.UNCERTAINTYPARAMETERMANAGEMENT.SingleOrDefault(s => s.ID == id));
 }
Exemplo n.º 43
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public SysMessageBLL(SysEntities entities)
 {
     db = entities;
 }
 /// <summary>
 /// 根据RULEID,获取所有不确定度参数管理数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable <UNCERTAINTYPARAMETERMANAGEMENT> GetByRefRULEID(SysEntities db, string id)
 {
     return(from c in db.UNCERTAINTYPARAMETERMANAGEMENT
            where c.RULEID == id
            select c);
 }
Exemplo n.º 45
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public ShenQingBLL(SysEntities entities)
 {
     db = entities;
 }
Exemplo n.º 46
0
 /// <summary>
 /// 通过主键id,获取员工补缴---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>员工补缴</returns>
 public EmployeeGoonPayment GetById(SysEntities db, int id)
 {
     return(db.EmployeeGoonPayment.SingleOrDefault(s => s.Id == id));
 }
Exemplo n.º 47
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public SysPersonBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 48
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public ChuLiBLL(SysEntities entities)
 {
     db = entities;
 }
 /// <summary>
 /// 通过主键id,获取实习经验---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>实习经验</returns>
 public InternshipExperience GetById(SysEntities db, string id)
 {
     return(db.InternshipExperience.SingleOrDefault(s => s.Id == id));
 }
Exemplo n.º 50
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public SysDocumentTalkBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 51
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public SysEmailBLL(SysEntities entities)
 {
     db = entities;
 }
Exemplo n.º 52
0
        /// <summary>
        /// 查询的数据
        /// </summary>
        /// <param name="SysEntities">数据访问的上下文</param>
        /// <param name="order">排序字段</param>
        /// <param name="sort">升序asc(默认)还是降序desc</param>
        /// <param name="search">查询条件</param>
        /// <param name="listQuery">额外的参数</param>
        /// <returns></returns>
        public IQueryable <VBUHEGE> GetData(SysEntities db, string order, string sort, string search, params object[] listQuery)
        {
            string where = string.Empty;
            int      flagWhere = 0;
            DateTime?startTime = null;
            DateTime?endTime   = null;
            Dictionary <string, string> queryDic = ValueConvert.StringToDictionary(search.GetString());

            if (queryDic != null && queryDic.Count > 0)
            {
                foreach (var item in queryDic)
                {
                    //oracle数据库使用linq对时间段查询
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key == "BAOGAOPIZHUNTONGGUOSHIJIANStart_Time") //开始时间
                    {
                        startTime = Convert.ToDateTime(item.Value);
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key == "BAOGAOPIZHUNTONGGUOSHIJIANEnd_Time") //结束时间+1
                    {
                        endTime = Convert.ToDateTime(item.Value).AddDays(1);
                        continue;
                    }
                    if (flagWhere != 0)
                    {
                        where += " and ";
                    }
                    flagWhere++;


                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(Start_Int)) //开始数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(Start_Int)) + "] >= " + item.Value.GetInt();
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(End_Int)) //结束数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(End_Int)) + "] <= " + item.Value.GetInt();
                        continue;
                    }

                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(DDL_Int)) //精确查询数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(DDL_Int)) + "] =" + item.Value;
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(DDL_String)) //精确查询字符串
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(DDL_String)) + "] = '" + item.Value + "'";
                        continue;
                    }
                    where += "it.[" + item.Key + "] like '%" + item.Value + "%'";//模糊查询
                }
            }
            var data = ((System.Data.Entity.Infrastructure.IObjectContextAdapter)db).ObjectContext
                       .CreateObjectSet <VBUHEGE>().Where(string.IsNullOrEmpty(where) ? "true" : where)
                       .OrderBy("it.[" + sort.GetString() + "] " + order.GetString())
                       .AsQueryable();

            if (null != startTime)
            {
                data = data.Where(m => startTime <= m.BAOGAOPIZHUNTONGGUOSHIJIAN);
            }
            if (null != endTime)
            {
                data = data.Where(m => endTime >= m.BAOGAOPIZHUNTONGGUOSHIJIAN);
            }
            return(data);
        }
 /// <summary>
 /// 通过主键id,获取评论---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>评论</returns>
 public Comment GetById(SysEntities db, string id)
 { 
     return db.Comment.SingleOrDefault(s => s.Id == id);
 
 }
Exemplo n.º 54
0
 /// <summary>
 /// 根据EmployeeAddId,获取所有员工补缴数据
 /// </summary>
 /// <param name="id">外键的主键</param>
 /// <returns></returns>
 public IQueryable <EmployeeGoonPayment> GetByRefEmployeeAddId(SysEntities db, int id)
 {
     return(from c in db.EmployeeGoonPayment
            where c.EmployeeAddId == id
            select c);
 }
Exemplo n.º 55
0
 /// <summary>
 /// 构造函数,默认加载数据访问上下文
 /// </summary>
 public ChuLiBLL()
 {
     db = new SysEntities();
 }
Exemplo n.º 56
0
 /// <summary>
 /// 通过主键id,获取操作---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>操作</returns>
 public SysOperation GetById(SysEntities db, string id)
 {
     return(db.SysOperation.SingleOrDefault(s => s.Id == id));
 }
Exemplo n.º 57
0
 /// <summary>
 /// 获取在该表中出现的所有外键实体
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>外键实体集合</returns>
 public IQueryable <SysMenu> GetRefSysMenu(SysEntities db)
 {
     return(from m in db.SysOperation
            from f in m.SysMenu
            select f);
 }
Exemplo n.º 58
0
        /// <summary>
        /// 查询的数据
        /// </summary>
        /// <param name="SysEntities">数据访问的上下文</param>
        /// <param name="order">排序字段</param>
        /// <param name="sort">升序asc(默认)还是降序desc</param>
        /// <param name="search">查询条件</param>
        /// <param name="listQuery">额外的参数</param>
        /// <returns></returns>
        public IQueryable <SysOperation> DaoChuData(SysEntities db, string order, string sort, string search, params object[] listQuery)
        {
            string where = string.Empty;
            int flagWhere = 0;

            Dictionary <string, string> queryDic = ValueConvert.StringToDictionary(search.GetString());

            if (queryDic != null && queryDic.Count > 0)
            {
                foreach (var item in queryDic)
                {
                    if (flagWhere != 0)
                    {
                        where += " and ";
                    }
                    flagWhere++;



                    if (queryDic.ContainsKey("SysMenu") && !string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key == "SysMenu")
                    {//查询多对多关系的列名
                        where += "EXISTS(select p from it.SysMenu as p where p.Id='" + item.Value + "')";
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(Start_Time)) //开始时间
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(Start_Time)) + "] >=  CAST('" + item.Value + "' as   System.DateTime)";
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(End_Time)) //结束时间+1
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(End_Time)) + "] <  CAST('" + Convert.ToDateTime(item.Value).AddDays(1) + "' as   System.DateTime)";
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(Start_Int)) //开始数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(Start_Int)) + "] >= " + item.Value.GetInt();
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(End_Int)) //结束数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(End_Int)) + "] <= " + item.Value.GetInt();
                        continue;
                    }

                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(DDL_Int)) //精确查询数值
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(DDL_Int)) + "] =" + item.Value;
                        continue;
                    }
                    if (!string.IsNullOrWhiteSpace(item.Key) && !string.IsNullOrWhiteSpace(item.Value) && item.Key.Contains(DDL_String)) //精确查询字符串
                    {
                        where += "it.[" + item.Key.Remove(item.Key.IndexOf(DDL_String)) + "] = '" + item.Value + "'";
                        continue;
                    }
                    where += "it.[" + item.Key + "] like '%" + item.Value + "%'";//模糊查询
                }
            }
            return(((System.Data.Entity.Infrastructure.IObjectContextAdapter)db).ObjectContext
                   .CreateObjectSet <SysOperation>().Where(string.IsNullOrEmpty(where) ? "true" : where)
                   .OrderBy("it.[" + sort.GetString() + "] " + order.GetString())
                   .AsQueryable());
        }
Exemplo n.º 59
0
 /// <summary>
 /// 已有数据访问上下文的方法中调用
 /// </summary>
 /// <param name="entities">数据访问上下文</param>
 public SysDocumentTalkBLL(SysEntities entities)
 {
     db = entities;
 }
Exemplo n.º 60
0
 /// <summary>
 /// 通过主键id,获取不合格统计分析---查看详细,首次编辑
 /// </summary>
 /// <param name="id">主键</param>
 /// <returns>不合格统计分析</returns>
 public VBUHEGE GetById(SysEntities db, string id)
 {
     return(db.VBUHEGE.SingleOrDefault(s => s.ID == id));
 }