Exemple #1
0
        public static T_CompanyModel DTO(this T_Company node)
        {
            if (node == null)
            {
                return(null);
            }
            var model = new T_CompanyModel()
            {
                Id           = node.Id,
                Company      = node.Company,
                Alias        = node.Alias,
                Phone        = node.Phone,
                Address      = node.Address,
                AgreementNo  = node.AgreementNo,
                Email        = node.Email,
                Fax          = node.Fax,
                GST          = node.GST,
                GSTReg       = node.GSTReg,
                License      = node.License,
                Logo         = node.Logo,
                ReceiptNo    = node.ReceiptNo,
                Registration = node.Registration,
                Departments  = node.Departments.Count() > 0 ? node.Departments.ToList().Select(s => s.DTO()).ToList() : null,
            };

            return(model);
        }
Exemple #2
0
 public static T_Company ToModel(this  T_CompanyModel node)
 {
     return(new T_Company()
     {
         Id = node.Id,
         Company = node.Company,
         Alias = node.Alias,
         Phone = node.Phone,
         Address = node.Address,
         AgreementNo = node.AgreementNo,
         Email = node.Email,
         Fax = node.Fax,
         GST = node.GST,
         GSTReg = node.GSTReg,
         License = node.License,
         Logo = node.Logo,
         ReceiptNo = node.ReceiptNo,
         Registration = node.Registration,
     });
 }
Exemple #3
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_CompanyModel> Search(T_CompanyModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_Company, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_Company, bool> > >(); //lambda查询条件集合
            int total      = 0;                                                  //总行数

            if (model.Company != null)
            {
                lambdaList.Add(c => c.Company.Contains(model.Company));
            }

            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_Company, T_Company> visitor = new MyVisitor <T_Company, T_Company>();

            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_CompanyModel>()
            {
                rows  = list,
                total = total
            };

            return(result);
        }
Exemple #4
0
 public int DeleteData(T_CompanyModel model)
 {
     return(this.Delete(model.Id));
 }
Exemple #5
0
 public int EditData(T_CompanyModel model)
 {
     return(this.Edit(model.ToModel()));
 }
Exemple #6
0
 public int AddData(T_CompanyModel model)
 {
     return(this.Add(model.ToModel()));
 }