Beispiel #1
0
        getOrganizationUnitList(FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param)
        {
            List <OrganizationUnit> list = new List <OrganizationUnit>();
            int count = 0;
            Tuple <List <OrganizationUnit>, int> ret = Tuple.Create(list, count);

            using (NaNaEntities db = new NaNaEntities()) {
                var predicate = PredicateBuilder.True <OrganizationUnit>();

                if (!string.IsNullOrEmpty(param.departmentName))
                {
                    predicate = predicate.And(x => x.organizationUnitName == param.departmentName);
                }

                list = db.OrganizationUnit.AsExpandable()
                       .Where(predicate)
                       .OrderBy(param.orderField.ToLower(), param.desc)
                       .Skip((param.pageIndex - 1) * param.pageSize)
                       .Take(param.pageSize).ToList();

                count = db.OrganizationUnit.AsExpandable().Where(predicate).OrderBy(param.orderField.ToLower(), param.desc).Count();
                ret   = Tuple.Create(list, count);
            }

            return(ret);
        }
Beispiel #2
0
        /// <summary>
        /// 修改油資補助金額
        /// </summary>
        public bool updateOilTransportationSubsidy(long id, Dictionary <string, object> dic)
        {
            bool ret = false;

            using (NaNaEntities db = new NaNaEntities()) {
                OilTransportationSubsidy o = db.OilTransportationSubsidy.AsQueryable().FirstOrDefault(x => x.id == id);

                //不存在此資料
                if (o == null)
                {
                    return(false);
                }

                Type cl = o.GetType();

                foreach (var obj in dic)
                {
                    if (cl.GetProperty(obj.Key) != null)
                    {
                        cl.GetProperty(obj.Key).SetValue(o, obj.Value);
                    }
                }
                db.SaveChanges();
                ret = true;
            }

            return(ret);
        }
Beispiel #3
0
        public bool updateERACategoryDynamicField(long id, Dictionary <string, object> dicObj)
        {
            bool ret = false;

            using (NaNaEntities db = new NaNaEntities()) {
                ERACategoryDynamicField e = db.ERACategoryDynamicField.AsQueryable().FirstOrDefault(x => x.Id == id);

                //不存在此資料
                if (e == null)
                {
                    return(false);
                }

                Type cl = e.GetType();

                foreach (var obj in dicObj)
                {
                    if (cl.GetProperty(obj.Key) != null)
                    {
                        cl.GetProperty(obj.Key).SetValue(e, obj.Value);
                    }
                }

                db.SaveChanges();
                ret = true;
            }

            return(ret);
        }
Beispiel #4
0
        getERADynamicFieldSettingList(FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param)
        {
            List <ERADynamicFieldSetting> list = new List <ERADynamicFieldSetting>();
            int count = 0;
            Tuple <List <ERADynamicFieldSetting>, int> ret = Tuple.Create(list, count);

            using (NaNaEntities db = new NaNaEntities()) {
                var predicate = PredicateBuilder.True <ERADynamicFieldSetting>();

                //if (!string.IsNullOrEmpty(param.name)) {
                //    predicate = predicate.And(x => x.name == param.name);
                //}

                list = db.ERADynamicFieldSetting.AsExpandable()
                       .Where(predicate)
                       .OrderBy(param.orderField, false)
                       .Skip((param.pageIndex - 1) * param.pageSize)
                       .Take(param.pageSize).ToList();

                count = db.ERADynamicFieldSetting.AsExpandable().Where(predicate).OrderBy(param.orderField, param.desc).Count();
                ret   = Tuple.Create(list, count);
            }

            return(ret);
        }
Beispiel #5
0
        public EmployeeViewModel.EmployeeInfoBasic getEmpBasicInfoByEmpId(string empID)
        {
            EmployeeViewModel.EmployeeInfoBasic ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ViewEmployeeLightInfo qryRet = db.ViewEmployeeLightInfo.FirstOrDefault(x => x.ID == empID);
                if (qryRet != null)
                {
                    ret = new EmployeeViewModel.EmployeeInfoBasic()
                    {
                        avatar       = string.Empty,
                        department   = qryRet.departmentName ?? string.Empty,
                        departmentId = qryRet.departmentID ?? string.Empty,
                        extNo        = qryRet.phoneNumber ?? string.Empty,
                        id           = qryRet.ID ?? string.Empty,
                        name         = qryRet.userName ?? string.Empty,
                        employeeOID  = qryRet.employeeOID ?? string.Empty,
                        ldap         = qryRet.ldapid ?? string.Empty,
                        userOID      = qryRet.userOID ?? string.Empty
                    };
                }
            }


            return(ret);
        }
Beispiel #6
0
        getViewERACategoryPermissionDynamicFieldSettingForInfList(FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param)
        {
            List <ViewERACategoryPermissionDynamicFieldSettingForInf> list = new List <ViewERACategoryPermissionDynamicFieldSettingForInf>();
            int count = 0;
            Tuple <List <ViewERACategoryPermissionDynamicFieldSettingForInf>, int> ret = Tuple.Create(list, count);

            using (NaNaEntities db = new NaNaEntities()) {
                var predicate = PredicateBuilder.True <ViewERACategoryPermissionDynamicFieldSettingForInf>();

                if (param.id != 0)
                {
                    predicate = predicate.And(x => x.Id == param.id);
                }

                list = db.ViewERACategoryPermissionDynamicFieldSettingForInf.AsExpandable()
                       .Where(predicate)
                       .OrderBy(param.orderField, param.desc)
                       .Skip((param.pageIndex - 1) * param.pageSize)
                       .Take(param.pageSize).ToList();

                count = db.ViewERACategoryPermissionDynamicFieldSettingForInf.AsExpandable().Where(predicate).OrderBy(param.orderField, param.desc).Count();

                ret = Tuple.Create(list, count);
            }

            return(ret);
        }
Beispiel #7
0
        public List <EmployeeViewModel.EmployeeInfoLight> getEmpInfoListByEmpIdArr(List <string> empIdArr)
        {
            List <EmployeeViewModel.EmployeeInfoLight> ret = new List <EmployeeViewModel.EmployeeInfoLight>();



            using (NaNaEntities db = new NaNaEntities()) {
                var query_list = db.ViewEmployeeLightInfo
                                 .Where(x => empIdArr.Contains(x.ID))
                                 .ToList();

                foreach (var e in query_list)
                {
                    ret.Add(new EmployeeViewModel.EmployeeInfoLight()
                    {
                        avatar       = "",
                        department   = string.IsNullOrEmpty(e.departmentName) ? "" : e.departmentName,
                        departmentId = string.IsNullOrEmpty(e.departmentID) ? "" : e.departmentID,
                        extNo        = string.IsNullOrEmpty(e.phoneNumber) ? "" : e.phoneNumber,
                        id           = string.IsNullOrEmpty(e.ID) ? "" : e.ID,
                        name         = string.IsNullOrEmpty(e.userName) ? "" : e.userName
                    });
                }
            }
            return(ret);
        }
Beispiel #8
0
        public bool updateAccountItemTaxRateSetting(long id, Dictionary <string, object> dic)
        {
            bool ret = false;

            using (NaNaEntities db = new NaNaEntities()) {
                AccountItemTaxRateSetting a = db.AccountItemTaxRateSetting.AsQueryable().First(x => x.id == id);

                if (a != null)
                {
                    Type cl = a.GetType();

                    foreach (var obj in dic)
                    {
                        if (cl.GetProperty(obj.Key) != null)
                        {
                            cl.GetProperty(obj.Key).SetValue(a, obj.Value);
                        }
                    }

                    db.SaveChanges();
                    ret = true;
                }
            }

            return(ret);
        }
Beispiel #9
0
        /// <summary>
        /// 取得油資補助列表
        /// </summary>
        public List <OilTransportationSubsidy> getOilTransportationSubsidyList(FormOptionsSettingViewModel.OilTransportationSubsidyParameter param)
        {
            List <OilTransportationSubsidy> ret = new List <OilTransportationSubsidy>();

            using (NaNaEntities db = new NaNaEntities()) {
                var predicate = PredicateBuilder.True <OilTransportationSubsidy>();

                if (param.transTypes.Count > 0)
                {
                    predicate = predicate.And(x => param.transTypes.Contains(x.type));
                }

                if (param.dateStart != null)
                {
                    predicate = predicate.And(x => x.dateStart >= param.dateStart);
                }

                if (param.dateEnd != null)
                {
                    predicate = predicate.And(x => x.dateEnd <= param.dateEnd);
                }

                ret = db.OilTransportationSubsidy.AsExpandable().Where(predicate)
                      .OrderBy(param.orderField, param.desc).ToList();
            }


            return(ret);
        }
Beispiel #10
0
        public bool updateFormFieldSetting(string id, Dictionary <string, object> dicObj)
        {
            bool ret = false;

            using (NaNaEntities db = new NaNaEntities()) {
                Guid guid_id = Guid.Parse(id);

                FormFieldsSetting f = db.FormFieldsSetting.AsQueryable().FirstOrDefault(x => x.id == guid_id);

                if (f == null)
                {
                    return(false);
                }

                Type cl = f.GetType();

                foreach (var obj in dicObj)
                {
                    if (cl.GetProperty(obj.Key) != null)
                    {
                        cl.GetProperty(obj.Key).SetValue(f, obj.Value);
                    }
                }
                db.SaveChanges();
                ret = true;
            }

            return(ret);
        }
Beispiel #11
0
        public HireEmployeeForm getHireEmployeeFormBySerialNumber(string serialNumber)
        {
            HireEmployeeForm ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.HireEmployeeForm.FirstOrDefault(x => x.processSerialNumber == serialNumber);
            }
            return(ret);
        }
Beispiel #12
0
        public MSG001 getMSGData(string proccessSerialNumber)
        {
            MSG001 ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.MSG001.FirstOrDefault(x => x.processSerialNumber == proccessSerialNumber);
            }
            return(ret);
        }
Beispiel #13
0
        public ERADynamicFieldSetting addERADynamicFieldSetting(ERADynamicFieldSetting e)
        {
            ERADynamicFieldSetting ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.ERADynamicFieldSetting.Add(e);
                db.SaveChanges();
            }
            return(ret);
        }
Beispiel #14
0
        public AccountItemTaxRateSetting getAccountItemTaxRateSetting(long id)
        {
            AccountItemTaxRateSetting ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.AccountItemTaxRateSetting.FirstOrDefault(x => x.id == id);
            }

            return(ret);
        }
Beispiel #15
0
        public ERACategoryDynamicField addERACategoryDynamicField(ERACategoryDynamicField e)
        {
            ERACategoryDynamicField ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.ERACategoryDynamicField.Add(e);
                db.SaveChanges();
            }
            return(ret);
        }
Beispiel #16
0
        public TempPaymentApplyForm getTempPaymentApplyForm(string proccessSerialNumber)
        {
            TempPaymentApplyForm ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.TempPaymentApplyForm.FirstOrDefault(x => x.processSerialNumber == proccessSerialNumber);
            }

            return(ret);
        }
Beispiel #17
0
        public OutsideCostApplyForm getOutsideCostApplyForm(string proccessSerialNumber)
        {
            OutsideCostApplyForm ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.OutsideCostApplyForm.FirstOrDefault(x => x.processSerialNumber == proccessSerialNumber);
            }

            return(ret);
        }
Beispiel #18
0
        public FormFieldsSetting addFormFieldSetting(FormFieldsSetting f)
        {
            FormFieldsSetting ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.FormFieldsSetting.Add(f);
                db.SaveChanges();
            }
            return(ret);
        }
Beispiel #19
0
        //ERAPermissionForInf
        public ERAPermissionForInf addERAPermissionForInf(ERAPermissionForInf e)
        {
            ERAPermissionForInf ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.ERAPermissionForInf.Add(e);
                db.SaveChanges();
            }

            return(ret);
        }
Beispiel #20
0
        /// <summary>
        /// 取得動態欄位列表(可以設定動態通知窗口)
        /// </summary>
        public List <FormFieldsSetting> getCustomNotifyFormFieldsSettingListByFormID(string formID)
        {
            List <FormFieldsSetting> ret = new List <FormFieldsSetting>();

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.FormFieldsSetting.Where(x => !x.deleted &&
                                                 x.formID == formID &&
                                                 x.custNotify).ToList();
            }
            return(ret);
        }
Beispiel #21
0
        /// <summary>
        /// 新增油資補助金額
        /// </summary>
        public OilTransportationSubsidy addOilTransportationSubsidy(OilTransportationSubsidy o)
        {
            OilTransportationSubsidy ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.OilTransportationSubsidy.Add(o);
                db.SaveChanges();
            }

            return(ret);
        }
Beispiel #22
0
        public AccountItemTaxRateSetting addAccountItemTaxRateSetting(AccountItemTaxRateSetting a)
        {
            AccountItemTaxRateSetting ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.AccountItemTaxRateSetting.Add(a);
                db.SaveChanges();
            }

            return(ret);
        }
Beispiel #23
0
        public EmployeeTransportationSetting addEmployeeTransportationSetting(EmployeeTransportationSetting e)
        {
            EmployeeTransportationSetting ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.EmployeeTransportationSetting.Add(e);
                db.SaveChanges();
            }

            return(ret);
        }
Beispiel #24
0
        /// <summary>
        /// 取得列表/總數
        /// </summary>
        public Tuple <List <FormOptionsSetting>, int> getFormOptionsSettingList(FormOptionsSettingViewModel.FormOptionsQueryParameter param)
        {
            Tuple <List <FormOptionsSetting>, int> ret = Tuple.Create(new List <FormOptionsSetting>(), 0);

            using (NaNaEntities db = new NaNaEntities()) {
                Guid guid_fieldID = Guid.Parse(param.fieldID);
                var  query_ret    = db.FormOptionsSetting.Where(x => x.fieldID == guid_fieldID && !x.deleted).OrderBy(x => x.sort);
                ret = Tuple.Create(query_ret.ToList(), query_ret.Count());
            }

            return(ret);
        }
Beispiel #25
0
        public List <HireEmployeeForm_gdProjectAchievement> getHireEmployeeFormGdProjectAchievementsByFormSerialNumber(string formSerialNumber)
        {
            List <HireEmployeeForm_gdProjectAchievement> ret = new List <HireEmployeeForm_gdProjectAchievement>();

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.HireEmployeeForm_gdProjectAchievement
                      .Where(x => x.formSerialNumber == formSerialNumber)
                      .OrderBy(y => y.OID).ToList();
            }

            return(ret);
        }
Beispiel #26
0
        public List <FormOptionsSetting> getFormOptionsSettingListByFieldID(Guid id)
        {
            List <FormOptionsSetting> ret = new List <FormOptionsSetting>();

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.FormOptionsSetting
                      .Where(x => x.fieldID == id && !x.deleted)
                      .OrderBy(x => x.sort)
                      .ToList();
            }
            return(ret);
        }
Beispiel #27
0
        public List <CostApplyForm_gridWithholdList> getCostApplyFormWithholdList(string formSerialNumber)
        {
            List <CostApplyForm_gridWithholdList> ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.CostApplyForm_gridWithholdList
                      .Where(x => x.formSerialNumber == formSerialNumber).ToList();

                //排序
                ret = ret.OrderBy(x => int.Parse(x.gd_sort)).ToList();
            }
            return(ret);
        }
Beispiel #28
0
        public Tuple <int, List <AccountItemTaxRateSetting> > getAccountItemTaxRateSettingList(AccountItemViewModel.AccountItemTaxRateSettingListQueryParameter param)
        {
            List <AccountItemTaxRateSetting> list = new List <AccountItemTaxRateSetting>();
            int count = 0;
            Tuple <int, List <AccountItemTaxRateSetting> > ret = null;

            using (NaNaEntities db = new NaNaEntities()) {
                var predicate = PredicateBuilder.True <AccountItemTaxRateSetting>();

                if (!string.IsNullOrEmpty(param.cashApplyTypeKey))
                {
                    predicate = predicate.And(x => x.applyTypeKey == param.cashApplyTypeKey);
                }
                if (!param.includeDeleteItem)
                {
                    predicate = predicate.And(x => !x.deleted);
                }

                //用關鍵字搜尋
                if (!string.IsNullOrEmpty(param.keyword))
                {
                    predicate = predicate.And(x =>
                                              x.code.Contains(param.keyword) ||
                                              x.itemName.Contains(param.keyword) ||
                                              x.memo.Contains(param.keyword));
                }

                if (string.IsNullOrEmpty(param.orderField))
                {
                    param.orderField = "dataCreated";
                }



                list = db.AccountItemTaxRateSetting.AsExpandable()
                       .Where(predicate)
                       .OrderBy(param.orderField, param.desc)
                       .Skip((param.pageIndex - 1) * param.pageSize)
                       .Take(param.pageSize)
                       .ToList();

                count = db.AccountItemTaxRateSetting.AsExpandable()
                        .Where(predicate).Count();

                ret = Tuple.Create(count, list);
            }


            return(ret);
        }
Beispiel #29
0
        public List <OutsideCostApplyForm_gdStatement> getOutsideCostApplyForm_gdStatementList(string formSerialNumber)
        {
            List <OutsideCostApplyForm_gdStatement> ret = new List <OutsideCostApplyForm_gdStatement>();

            using (NaNaEntities db = new NaNaEntities()) {
                ret = db.OutsideCostApplyForm_gdStatement
                      .Where(x => x.formSerialNumber == formSerialNumber).ToList();

                //排序
                ret = ret.OrderBy(x => int.Parse(x.gd_no)).ToList();
            }

            return(ret);
        }
Beispiel #30
0
        public List <MSG001_gridMsg> getMSGGridList(string formSerialNumber)
        {
            List <MSG001_gridMsg> ret = new List <MSG001_gridMsg>();

            using (NaNaEntities db = new NaNaEntities()) {
                ret = (from m in db.MSG001_gridMsg
                       where m.formSerialNumber == formSerialNumber
                       select m).ToList();
                //排序
                ret = ret.OrderBy(x => int.Parse(x.gd_sort)).ToList();
            }

            return(ret);
        }