Ejemplo n.º 1
0
        public void getSalaryItems()
        {
            try
            {
                string record = this.Request["record"];

                BaseBll          bll  = new BaseBll();
                List <tprsalitm> list = bll.GetSelectedRecords <tprsalitm>(new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "bkal", ColumnValue = "Y"
                    }
                });
                var finList = (from p in list
                               select new ValueInfo {
                    ValueField = p.itcd, DisplayField = p.itnm
                }).ToList();

                string json = JavaScriptConvert.SerializeObject(finList);
                json = "{results:" + finList.Count + ",rows:" + json + "}";

                Response.Output.Write(json);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// dataTable
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public JsonResult GetTableData(DataTablesParameters parameters)
        {
            IBaseBll <FieldInfo> fieldBll = new BaseBll <FieldInfo>();
            var list  = fieldBll.QueryByIf(m => m.TableId == Convert.ToInt32(parameters.TableId)).ToList();
            var count = list.Count();

            return(DataTablesJson(parameters.Draw, count, count, list));
        }
Ejemplo n.º 3
0
 public BaseController(BaseBll <TClass> bll, IOptions <SysConfig> config = null)
 {
     if (config != null)
     {
         _sysConfig = config.Value;
     }
     _bll = bll;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 创建导入过程中所需要的实例
        /// </summary>
        private void BuildInstance()
        {
            CacheManager = CacheManager.GetInstance();

            OracleBaseBll =
                ReflectorHelper.GetInstance("Guoli.Bll", $"Guoli.Bll.{OracleTableName}Bll") as BaseBll <TOracle>;

            SqlserverBaseBll =
                ReflectorHelper.GetInstance("Guoli.Bll", $"Guoli.Bll.{SqlserverTableName}Bll") as BaseBll <TSqlserver>;
        }
Ejemplo n.º 5
0
        public static void Test(EntityObject obj)
        {
            T_FB_TRAVELEXPAPPLYMASTER bb = obj as T_FB_TRAVELEXPAPPLYMASTER;
            BaseBll<T_FB_TRAVELEXPAPPLYMASTER> b = new BaseBll<T_FB_TRAVELEXPAPPLYMASTER>();
            T_FB_TRAVELEXPAPPLYMASTER t = b.GetTable().First();
            T_FB_TRAVELEXPAPPLYDETAIL t1 = new T_FB_TRAVELEXPAPPLYDETAIL();

            T_FB_TRAVELEXPAPPLYDETAIL t2 = bb.T_FB_TRAVELEXPAPPLYDETAIL.ToList()[0];
            t.T_FB_TRAVELEXPAPPLYDETAIL.Add(t1);
            t.T_FB_TRAVELEXPAPPLYDETAIL.Add(t2);
            b.dal.GetDataContext().SaveChanges();
        }
Ejemplo n.º 6
0
        public JsonResult GetTreeData()
        {
            IBaseBll <TableInfo> tableBll = new BaseBll <TableInfo>();
            var treeNodes = tableBll.QueryAll().Select(m => new
            {
                id     = m.Id,
                parent = m.ParentId.ToString() == "0" ? "#" : m.ParentId.ToString(),
                text   = m.NameCh,
                icon   = m.TreeIcon
            });

            return(Json(treeNodes, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
        public static void Test(EntityObject obj)
        {
            T_FB_TRAVELEXPAPPLYMASTER           bb = obj as T_FB_TRAVELEXPAPPLYMASTER;
            BaseBll <T_FB_TRAVELEXPAPPLYMASTER> b  = new BaseBll <T_FB_TRAVELEXPAPPLYMASTER>();
            T_FB_TRAVELEXPAPPLYMASTER           t  = b.GetTable().First();
            T_FB_TRAVELEXPAPPLYDETAIL           t1 = new T_FB_TRAVELEXPAPPLYDETAIL();

            T_FB_TRAVELEXPAPPLYDETAIL t2 = bb.T_FB_TRAVELEXPAPPLYDETAIL.ToList()[0];

            t.T_FB_TRAVELEXPAPPLYDETAIL.Add(t1);
            t.T_FB_TRAVELEXPAPPLYDETAIL.Add(t2);
            b.dal.GetDataContext().SaveChanges();
        }
Ejemplo n.º 8
0
        public JsonResponse AddAccountList([FromBody] AccountListDto dto)
        {
            //判断用户是否登录
            if (!TokenHelper.CheckLoginStateByUserId(dto.UserId))
            {
                return(BadResponse("用户未登录", null, false));
            }
            string accountName = "我的手账";

            //若用户没有写账单名则默认为“我的手账”;若有“我的手账”则命名为“我的手账1”
            if (dto.Name != null && dto.Name != "")
            {
                List <AccountList> accountList = AccountListBll.GetListByCreateUserId(dto.UserId).ToList();
                int flag = 1;
                for (int i = 0; i < accountList.Count; i++)
                {
                    if (accountList[i].Name == accountName)
                    {
                        accountName = (accountName + flag.ToString());
                        flag++;
                    }
                }
            }
            else
            {
                accountName = dto.Name;
            }
            //往AccountList写账单基本信息
            DateTime    time  = DateTime.Now;
            AccountList model = new AccountList
            {
                AllUserId = dto.AllUserId,
                Code      = "Z" + (time.Year - 2000).ToString() + time.Month.ToString() + time.Day.ToString()
                            + TokenHelper.GetRandomString(3, false, true, true, false, "") + TokenHelper.GetRandomString(5, true, true, true, false, ""),
                CreateDate   = time,
                CreateUserId = dto.UserId,
                Member       = dto.AllUserId.Split(',').Length,
                Name         = accountName
            };

            //新建账单表
            if (BaseBll <AccountList> .ExecuteSql("exec proc_CreateAccountTable '" + model.Code + "'") &&
                AccountListBll.Insert(model))
            {
                return(OkResponse(null, "添加成功!"));
            }
            else
            {
                return(BadResponse("添加失败!", null));
            }
        }
Ejemplo n.º 9
0
        public void UpdateMUF(string muid, string action)
        {
            try
            {
                BaseBll bll = new BaseBll();
                if (action == "add")
                {
                    tstmnumuf muf = new tstmnumuf();
                    muf.apnm = Parameter.APPLICATION_NAME;
                    muf.muid = muid.Trim();
                    muf.urid = Function.GetCurrentUser();
                    muf.adtm = DateTime.Now;

                    bll.DoInsert <tstmnumuf>(muf);
                }

                if (action == "delete")
                {
                    List <ColumnInfo> parameters = new List <ColumnInfo>()
                    {
                        new ColumnInfo()
                        {
                            ColumnName = "muid", ColumnValue = muid
                        },
                        new ColumnInfo()
                        {
                            ColumnName = "apnm", ColumnValue = Parameter.APPLICATION_NAME
                        },
                        new ColumnInfo()
                        {
                            ColumnName = "urid", ColumnValue = Function.GetCurrentUser()
                        }
                    };

                    tstmnumuf obj = bll.GetSelectedObject <tstmnumuf>(parameters);
                    if (obj != null)
                    {
                        //bll.DoDelete<tstmnumuf>(parameters);
                        bll.DoDelete <tstmnumuf>(obj);
                    }
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }
Ejemplo n.º 10
0
        public DataTable CustomerQuery(string Sqlstring, ref string ReturnMSG)
        {
            DataTable dt = new DataTable();

            try
            {
                BaseBll <T_HR_COMPANY> bll = new BaseBll <T_HR_COMPANY>();
                dt = bll.CustomerQuery(Sqlstring) as DataTable;
            }
            catch (Exception ex)
            {
                ReturnMSG = ex.ToString();
                Tracer.Debug(ex.ToString());
            }
            return(dt);
        }
Ejemplo n.º 11
0
        public void GetPageDataDataTableTest()
        {
            PageCriteria page = new PageCriteria();

            page.TableName = "ProductInfo p left join  ProductClassInfo c on p.ClassId=c.ClassId"
                             + " left join  SellerStockPile s on s.ProductId = p.ProductId"
                             + " left join  PictureInfo i on i.PicId = p.Picture1";
            page.Fields      = "p.ProductId,p.ProductCode,p.ProductFullName,c.Name as ClassName,i.Resource as picName,s.Quantity,p.ProductSpec,p.Price1,i.Format,p.SellerId";
            page.Condition   = "";
            page.PrimaryKey  = "p.ProductId";
            page.PageSize    = 10;
            page.CurrentPage = 1;
            var ret = BaseBll <object> .GetPageDataDataTable(page, 0, out _errMsg);

            Assert.IsTrue(ret != null);
        }
Ejemplo n.º 12
0
        public JsonResult GetTableInfo(int id)
        {
            IBaseBll <TableInfo> tableBll = new BaseBll <TableInfo>();
            var    info        = tableBll.QueryById(id);
            string tableStatus = info.TableState == 1?"正常" : "禁用";

            return(Json(new
            {
                table_name_cn = info.NameCh,
                table_name = info.NameEn,
                table_type = info.TableType,
                key_name = info.TableKey,
                table_status = tableStatus,
                unique_index = info.TableIndex,
                description = info.TableExplain
            }));
        }
Ejemplo n.º 13
0
        public DataSet GetPayrollBankAllocData(string rpcd, List <trpexrpdd> lstDtl, List <ColumnInfo> lstParameters)
        {
            string sSql = BuildSql(rpcd, lstDtl, lstParameters);

            BaseBll bll = new BaseBll();
            DataSet ds  = bll.ExecuteRawSQLQuery(sSql);

            string strXML = ConvertToXML_Personal(ds, lstDtl);

            DataSet dsFin = new DataSet();

            XmlReader reader = XmlReader.Create(new System.IO.StringReader(strXML));

            dsFin.ReadXml(reader);

            return(dsFin);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 获取所有公司
 /// </summary>
 /// <returns>所有有效的公司</returns>
 public List<CompanyModel> GetAllCompany()
 {
     using (BaseBll<T_HR_COMPANY> bsb = new BaseBll<T_HR_COMPANY>())
     {
         var companyList = from v in bsb.GetTable()
                           where v.EDITSTATE =="1" && v.CHECKSTATE=="2"
                           select new CompanyModel
                           {
                               CompanyID = v.COMPANYID,
                               ShortName = v.BRIEFNAME,
                               CompanyName = v.CNAME,
                               ParentID = v.FATHERID,
                               SORTINDEX = v.SORTINDEX,
                               FatherType = v.FATHERTYPE
                           };
         return companyList.ToList();
     }
 }
Ejemplo n.º 15
0
 /// <summary>
 /// 获取所有公司
 /// </summary>
 /// <returns>所有有效的公司</returns>
 public List <CompanyModel> GetAllCompany()
 {
     using (BaseBll <T_HR_COMPANY> bsb = new BaseBll <T_HR_COMPANY>())
     {
         var companyList = from v in bsb.GetTable()
                           where v.EDITSTATE == "1" && v.CHECKSTATE == "2"
                           select new CompanyModel
         {
             CompanyID   = v.COMPANYID,
             ShortName   = v.BRIEFNAME,
             CompanyName = v.CNAME,
             ParentID    = v.FATHERID,
             SORTINDEX   = v.SORTINDEX,
             FatherType  = v.FATHERTYPE
         };
         return(companyList.ToList());
     }
 }
Ejemplo n.º 16
0
        public void GetMaxNo()
        {
            string message = string.Empty;

            try
            {
                string    record = this.Request["record"];
                Hashtable ht     = JavaScriptConvert.DeserializeObject <Hashtable>(record);

                BaseBll bll = new BaseBll();

                if (ht["field"].ToString().Equals(string.Empty))
                {
                    message = "{status:'success',msg:''}";
                }
                else
                {
                    int?list = bll.GetMaxNo(ht["tablename"].ToString(), ht["field"].ToString());

                    string sMax = string.Empty;

                    if (!list.HasValue)
                    {
                        sMax = "1";
                    }
                    else
                    {
                        sMax = Convert.ToString(list + 1);
                    }

                    message = "{status:'success',msg:'" + sMax + "'}";
                }
            }
            catch (Exception ex)
            {
                message = "{status:'fail',msg:''}";;
            }
            Response.Output.Write(message);
        }
Ejemplo n.º 17
0
        public void DeletePriRuleSet(List <ColumnInfo> _parameters)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    BaseBll          baseBll = new BaseBll();
                    List <tprprirst> lstDtl  = baseBll.GetSelectedRecords <tprprirst>(_parameters);
                    for (int i = 0; i < lstDtl.Count; i++)
                    {
                        if (lstDtl[i].vtyp == "Sum")
                        {
                            //delete rel item
                            List <ColumnInfo> relparams = new List <ColumnInfo>()
                            {
                                new ColumnInfo()
                                {
                                    ColumnName = "rlcd", ColumnValue = lstDtl[i].rlcd
                                }
                            };
                            DoMultiDelete <tprrstsit>(relparams);
                        }

                        DoDelete <tprprirst>(lstDtl[i]);
                    }

                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }
Ejemplo n.º 18
0
        public void getDelete <T, P>()
            where T : class
            where P : class
        {
            string message = "{}";

            try
            {
                string            record     = this.Request["record"];
                Hashtable         ht         = JavaScriptConvert.DeserializeObject <Hashtable>(record);
                List <ColumnInfo> parameters = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["params"].ToString());

                T       bll     = (T)typeof(T).GetConstructor(new Type[] { }).Invoke(new object[] { });
                BaseBll baseBll = bll as BaseBll;

                baseBll.DoDelete <T>(parameters);
                message = "{status:'success',msg:'" + HRMSRes.Public_Message_DeleteWell + "'}";
            }
            catch (Exception ex)
            {
                message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_DeleteBad, ex, true) + "'}";
            }
            Response.Write(message);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 数据表刷新
 /// </summary>
 /// <param name="baseBll"></param>
 /// <returns></returns>
 public DataTable  LoadData(BaseBll <BaseModel> baseBll)
 {
     return(baseBll.GetDataTable());
 }
Ejemplo n.º 20
0
        public List <object> GetCalendarDetails(List <ColumnInfo> _parameter)
        {
            List <tatclddtl> result    = new List <tatclddtl>();
            DateTime         startDate = DateTime.Now;
            DateTime         endDate   = DateTime.Now;
            string           otcd      = string.Empty;
            string           htcd      = string.Empty;

            var q = from p in _parameter
                    where p.ColumnName == "stdt"
                    select p.ColumnValue;

            startDate = Convert.ToDateTime(q.Single());

            q = from p in _parameter
                where p.ColumnName == "endt"
                select p.ColumnValue;

            endDate = Convert.ToDateTime(q.Single());

            q = from p in _parameter
                where p.ColumnName == "otcd"
                select p.ColumnValue;

            otcd = q.Single();

            q = from p in _parameter
                where p.ColumnName == "htcd"
                select p.ColumnValue;

            htcd = q.Single();

            //tbssyscfgBll syscfgBll = new tbssyscfgBll();
            int  weekday   = Convert.ToUInt16(((StSystemConfig)Parameter.CURRENT_SYSTEM_CONFIG).AtWDPW);//syscfgBll.GetSysParameter_Weekwkdas();
            bool isHoliday = false;

            while (startDate <= endDate)
            {
                if (weekday == 5)
                {
                    if ((startDate.DayOfWeek == DayOfWeek.Saturday) || (startDate.DayOfWeek == DayOfWeek.Sunday))
                    {
                        isHoliday = true;
                    }
                    else
                    {
                        isHoliday = false;
                    }
                }
                else if (weekday == 6)
                {
                    if ((startDate.DayOfWeek == DayOfWeek.Sunday))
                    {
                        isHoliday = true;
                    }
                    else
                    {
                        isHoliday = false;
                    }
                }

                if (isHoliday)
                {
                    tatclddtl dtl = new tatclddtl()
                    {
                        cddt = startDate,
                        htcd = htcd,
                        otcd = otcd,
                        remk = "auto generation",
                        lmtm = DateTime.Now,
                        lmur = "System"
                    };
                    result.Add(dtl);
                }

                startDate = startDate.AddDays(1);
            }

            string  htnm    = string.Empty;
            string  otnm    = string.Empty;
            BaseBll baseBll = new BaseBll();

            tathldtyp ht = baseBll.GetSelectedObject <tathldtyp>(new List <ColumnInfo>()
            {
                new ColumnInfo()
                {
                    ColumnName = "htcd", ColumnValue = htcd
                }
            });

            htnm = ht.htnm;
            tottype ottype = baseBll.GetSelectedObject <tottype>(new List <ColumnInfo>()
            {
                new ColumnInfo()
                {
                    ColumnName = "otcd", ColumnValue = otcd
                }
            });

            otnm = ottype.otnm;

            var q1 = from p in result
                     select new
            {
                p.cddt,
                p.htcd,
                p.otcd,
                p.remk,
                p.lmtm,
                p.lmur,
                htnm = htnm,
                otnm = otnm
            };

            return(q1.Cast <object>().ToList());
        }
Ejemplo n.º 21
0
        private void LoadData(string rpcd, List <ColumnInfo> lstParameters)
        {
            BaseBll bll = new BaseBll();

            trpexrpdf def = bll.GetSelectedObject <trpexrpdf>(new List <ColumnInfo>()
            {
                new ColumnInfo()
                {
                    ColumnName = "rpcd", ColumnValue = rpcd
                }
            });

            List <trpexrpdd> lstDtl = bll.GetSelectedRecords <trpexrpdd>(new List <ColumnInfo>()
            {
                new ColumnInfo()
                {
                    ColumnName = "rpcd", ColumnValue = rpcd
                }
            });

            rpexrpdpBll rpbll = new rpexrpdpBll();
            DataSet     ds    = null;

            switch (def.rpty)
            {
            case "Personnel":
                ds = rpbll.GetPersonalData(rpcd, lstDtl, lstParameters);
                break;

            case "Payroll":
                ds = rpbll.GetPayrollData(rpcd, lstDtl, lstParameters);
                break;

            case "PayrollBankAlloc":
                ds = rpbll.GetPayrollBankAllocData(rpcd, lstDtl, lstParameters);
                break;
            }

            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                //Title
                this.GridView1.Caption = "<B>" + def.rptt + "</B>";

                this.GridView1.DataSource = ds;
                this.GridView1.DataBind();

                //Merge Column
                MergeGridView mergeGV = new MergeGridView();
                for (int i = 0; i < lstDtl.Count; i++)
                {
                    if (lstDtl[i].isme == "Y")
                    {
                        mergeGV.Merge(this.GridView1, i);
                    }
                }

                //Summary
                var q = (from p in lstDtl
                         where p.issu == "Y"
                         select p).ToList();

                for (int i = 0; i < q.Count; i++)
                {
                    //GridViewSummary sum = new GridViewSummary(q[i].itnm, SummaryOperation.Sum);
                }
            }
            else
            {
            }
        }
Ejemplo n.º 22
0
        public void AnalyzeOT(ref AtCalculationInfo _store, tatshift curShift, List <tatoridat> _lstOriAtData, bool _isSaveDetail)
        {
            DateTime effOTStart = DateTime.Parse(UtilDatetime.FormatDate1(_store.CurDay) + " " + curShift.eati); // analatBll.CompareTime(_store.CurDay, curShift.eati, curShift.tmin);
            //有效加班时间=第二日最早有效上班打卡时间之前
            DateTime         effOTEnd      = effOTStart.AddDays(1);                                              //analatBll.CompareTime(_store.CurDay, curShift.tmot, curShift.lato);
            DateTime         otStart       = analatBll.CompareTime(_store.CurDay, curShift.tmin, curShift.nots);
            double           othr          = 0;
            double           othrReal      = 0;
            double           totalOthr     = 0;
            double           totalOthrReal = 0;
            List <tatshfott> lstShiftOT    = new List <tatshfott>();

            if (lstOTType == null)
            {
                lstOTType = analatBll.GetOTType();
            }
            lstShiftOT = new BaseBll().GetSelectedRecords <tatshfott>(new List <ColumnInfo>()
            {
            }).OrderBy(p => p.otst).ToList();

            string otType = AnalyzeOTType(_store, lstOTType);

            string           sfid            = _store.EmpInfo.sfid;
            List <tatoridat> lstEmpOriAtData = _lstOriAtData.Where(p => p.sfid == sfid &&
                                                                   p.retm >= effOTStart &&
                                                                   p.retm < effOTEnd)
                                               .OrderBy(p => p.retm)
                                               .ToList();

            if (lstEmpOriAtData.Count < 1)
            {
                //没有加班打卡记录
                othr          = 0;
                othrReal      = 0;
                totalOthr     = 0;
                totalOthrReal = 0;
            }
            else
            {
                otdetailDal dal = new otdetailDal();

                //有上班前加班打卡记录
                //暂时不考虑上班打卡,2009-01-01 by Administrator
                //if (lstEmpOriAtData.First().retm < _store.StdTimeIn)
                //{
                //    TimeSpan diff = _store.StdTimeIn.Value - lstEmpOriAtData.First().retm;
                //    if (diff.TotalMinutes > curShift.miot)
                //    {
                //        othr = (diff.TotalMinutes % curShift.otun.Value) * curShift.otun.Value / 60;
                //        othrReal = diff.TotalMinutes / 60;
                //    }
                //    else
                //    {
                //        othr = 0;
                //        othrReal = 0;
                //    }

                //    if ((_isSaveDetail) && (othr!=0))
                //        dal.SaveOTDetail(_store.EmpInfo.emno, otType, _store.CurDay, lstEmpOriAtData.First().retm, _store.StdTimeIn.Value, othr, othrReal, 0.0);
                //}

                //有下班后加班打卡记录
                if (lstEmpOriAtData.Last().retm > otStart)
                {
                    if (lstShiftOT.Count > 0)
                    {
                        //定义了加班权重
                        DateTime        retm = lstEmpOriAtData.Last().retm;
                        DateTime        otst;
                        List <DateTime> lstDateTime    = new List <DateTime>();
                        List <string>   lstShiftOTType = new List <string>();
                        lstDateTime.Add(otStart);

                        for (int i = 0; i < lstShiftOT.Count; i++)
                        {
                            tatshfott shiftOT = lstShiftOT[i];
                            otst = analatBll.CompareTime(otStart, otStart.ToString("HH:mm:ss"), shiftOT.otst);
                            if (otst > retm)
                            {
                                lstDateTime.Add(retm);
                            }
                            else
                            {
                                if (i == (lstShiftOT.Count - 1))
                                {
                                    lstDateTime.Add(retm);
                                }
                                else
                                {
                                    lstDateTime.Add(otst);
                                }
                            }
                            lstShiftOTType.Add(shiftOT.otcd);
                        }

                        for (int i = 1; i < lstDateTime.Count; i++)
                        {
                            //如果下一个时段的比最小加班时间小,则累计到上一个区间
                            TimeSpan diff1 = new TimeSpan(0, 0, 0);
                            if ((i + 1) <= (lstDateTime.Count - 1))
                            {
                                diff1 = lstDateTime[i + 1] - lstDateTime[i];
                                if (diff1.TotalMinutes > curShift.miot)
                                {
                                    diff1 = new TimeSpan(0, 0, 0);
                                }
                            }

                            TimeSpan diff = lstDateTime[i] - lstDateTime[i - 1] + diff1;
                            if (diff.TotalMinutes > curShift.miot)
                            {
                                othr     = Math.Floor(diff.TotalMinutes / curShift.otun.Value) * curShift.otun.Value / 60;
                                othrReal = diff.TotalMinutes / 60;

                                totalOthr     += othr;
                                totalOthrReal += othrReal;

                                if ((_isSaveDetail) && (othr != 0))
                                {
                                    dal.SaveOTDetail(_store.EmpInfo.emno, lstShiftOTType[i - 1], _store.CurDay, lstDateTime[i - 1], lstDateTime[i], othr, othrReal, 0);
                                }
                            }
                        }
                    }
                    else
                    {
                        //没有定义加班权重
                        TimeSpan diff = lstEmpOriAtData.Last().retm - otStart;
                        if (diff.TotalMinutes > curShift.miot)
                        {
                            othr     = Math.Floor(diff.TotalMinutes / curShift.otun.Value) * curShift.otun.Value / 60;
                            othrReal = diff.TotalMinutes / 60;

                            totalOthr     += othr;
                            totalOthrReal += othrReal;

                            if ((_isSaveDetail) && (othr != 0))
                            {
                                dal.SaveOTDetail(_store.EmpInfo.emno, otType, _store.CurDay, otStart, lstEmpOriAtData.Last().retm, othr, othrReal, 0);
                            }
                        }
                    }
                }
            }

            otcd           = otType;
            _store.OTHours = totalOthr;
        }
Ejemplo n.º 23
0
        public DataSet GetPersonalData(string rpcd, List <trpexrpdd> lstDtl, List <ColumnInfo> lstParameters)
        {
            var tables = lstDtl.Select(p => p.tbnm).Distinct().ToList();

            StringBuilder sbSql   = new StringBuilder();
            StringBuilder sbTable = new StringBuilder();

            #region Build Select
            var columns = lstDtl.OrderBy(p => p.sqno).ToList();
            sbSql.Append("select ");
            for (int i = 0; i < columns.Count; i++)
            {
                if (i > 0)
                {
                    sbSql.Append(",");
                }

                sbSql.Append(columns[i].tbnm + "." + columns[i].itfd);
            }
            #endregion

            #region Build From
            sbSql.Append(" " + "from" + " ");
            for (int i = 0; i < tables.Count; i++)
            {
                sbSql.Append(tables[i].ToString());

                if (i < tables.Count - 1)
                {
                    sbSql.Append(",");
                }
            }
            #endregion

            #region Build Where
            sbSql.Append(" " + "where 1=1" + " ");
            for (int i = 0; i < lstParameters.Count; i++)
            {
                if (i == 0)
                {
                    sbSql.Append(" " + "and" + " ");
                }

                var q = (from p in lstDtl
                         where p.itfd == lstParameters[i].ColumnName
                         select p).ToList();

                if (q.Count > 0)
                {
                    switch (q[0].itty)
                    {
                    case "string":
                    case "datetime":
                        sbSql.Append("(" + q[0].tbnm + "." + q[0].itfd + "='" + lstParameters[i].ColumnValue.ToString() + "')");
                        break;

                    case "float":
                        sbSql.Append("(" + q[0].tbnm + "." + q[0].itfd + "=" + lstParameters[i].ColumnValue + ")");
                        break;
                    }
                }
            }
            #endregion

            #region Build Order
            sbSql.Append(" ");
            var orders = lstDtl.Where(p => p.isor == "Y").ToList();
            for (int i = 0; i < orders.Count; i++)
            {
                if (i == 0)
                {
                    sbSql.Append(" " + "order by" + " ");
                }

                sbSql.Append(orders[i].tbnm + "." + orders[i].itfd);
                if (i < orders.Count - 1)
                {
                    sbSql.Append(",");
                }
            }
            #endregion

            BaseBll bll = new BaseBll();
            //List< lstObj = bll.ExecuteRawSQLQueryy<object>(sbSql.ToString());
            DataSet ds = bll.ExecuteRawSQLQuery(sbSql.ToString());

            string strXML = ConvertToXML_Personal(ds, lstDtl);

            DataSet dsFin = new DataSet();

            XmlReader reader = XmlReader.Create(new System.IO.StringReader(strXML));
            dsFin.ReadXml(reader);

            return(dsFin);
        }
Ejemplo n.º 24
0
 public DataTable CustomerQuery(string Sqlstring,ref string ReturnMSG)
 {
     DataTable dt = new DataTable();
     try
     {
       
         BaseBll<T_HR_COMPANY> bll = new BaseBll<T_HR_COMPANY>();
         dt = bll.CustomerQuery(Sqlstring) as DataTable;
     }
     catch (Exception ex)
     {
         ReturnMSG = ex.ToString();
         Tracer.Debug(ex.ToString());
     }
     return dt;
 }
Ejemplo n.º 25
0
        public void Publish(List <vw_employment> lstEmp, string trcd, string isEmail, string isBoard)
        {
            try
            {
                List <ColumnInfo> lstParameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "trcd", ColumnValue = trcd
                    }
                };

                ttrtraing tra = new BaseBll().GetSelectedObject <ttrtraing>(lstParameters);

                if (tra == null)
                {
                    return;
                }

                using (TransactionScope scope = new TransactionScope())
                {
                    for (int i = 0; i < lstEmp.Count; i++)
                    {
                        vw_employment emp = lstEmp[i];

                        ttrtraatt att = new ttrtraatt();
                        att.emno = emp.emno;
                        att.isat = "N";
                        att.isrg = "N";
                        att.lmtm = DateTime.Now;
                        att.lmur = Function.GetCurrentUser();
                        att.trcd = trcd;

                        DoInsert <ttrtraatt>(att);

                        alarmBll alaBll = new alarmBll();
                        if (isEmail == "Y")
                        {
                            //发Email
                            tstalarm alarmMdl = alaBll.BuildAlarmMdl(Alarm_AlarmType.Email, "Training: " + tra.trnm,
                                                                     alaBll.BuildTrainingAlarmBody(tra, att.emno), emp.emno, string.Empty,
                                                                     "Training", DateTime.Now.AddDays(1), string.Empty);

                            DoInsert <tstalarm>(alarmMdl);
                        }

                        if (isBoard == "Y")
                        {
                            //发送Board
                            tstalarm alarmMdl = alaBll.BuildAlarmMdl(Alarm_AlarmType.Board, "Training: " + tra.trnm,
                                                                     alaBll.BuildTrainingAlarmBody(tra, att.emno), emp.emno, string.Empty,
                                                                     "Training", DateTime.Now.AddDays(1), string.Empty);

                            DoInsert <tstalarm>(alarmMdl);
                        }

                        //update ispb标识
                        tra.ispb = "Y";

                        DoUpdate <ttrtraing>(tra, lstParameters);
                    }

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 26
0
        public void UpdatePriRuleSet(string _emno, List <tprprirst> list)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    //delete first
                    List <ColumnInfo> parameters = new List <ColumnInfo>()
                    {
                        new ColumnInfo()
                        {
                            ColumnName = "emno", ColumnValue = _emno
                        }
                    };
                    BaseBll          baseBll = new BaseBll();
                    List <tprprirst> lstDtl  = baseBll.GetSelectedRecords <tprprirst>(parameters, true);
                    for (int i = 0; i < lstDtl.Count; i++)
                    {
                        if (lstDtl[i].vtyp == "Sum")
                        {
                            //delete rel item
                            List <ColumnInfo> relparams = new List <ColumnInfo>()
                            {
                                new ColumnInfo()
                                {
                                    ColumnName = "rlcd", ColumnValue = lstDtl[i].rlcd
                                }
                            };
                            DoMultiDelete <tprrstsit>(relparams);
                        }
                        //DoDelete<tprprirst>(lstDtl[i]);
                    }

                    DoMultiDelete <tprprirst>(parameters);

                    for (int i = 0; i < list.Count; i++)
                    {
                        string rlcd = UtilDatetime.FormatTime4(DateTime.Now);
                        if (list[i].vtyp == "Sum")
                        {
                            list[i].rlcd = rlcd;
                        }

                        DoInsert <tprprirst>(list[i]);

                        if (list[i].vtyp == "Sum")
                        {
                            string[] arr = list[i].valu.Split(',');
                            for (int j = 0; j < arr.Length; j++)
                            {
                                tprrstsit sit = new tprrstsit();
                                sit.itcd = arr[j].Substring(1, arr[j].Length - 2);
                                sit.lmtm = list[i].lmtm;
                                sit.lmur = list[i].lmur;
                                sit.rlcd = rlcd;

                                DoInsert <tprrstsit>(sit);
                            }
                        }
                    }
                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 得到数据来源的开挖坐标系
        /// </summary>
        /// <param name="id">数据来源ID</param>
        /// <param name="pts"></param>
        /// <returns></returns>
        public static bool get_KWZBPt3(string id, out sg_Vector3[] pts)
        {
            // 坐标系ID
            pts = new sg_Vector3[3];

            string zbxtid = ColumnType.ConvertStringNotDBNull(BaseBll.GetSingleValue(
                                                                  $"SELECT ZBXTID FROM SJLYK WHERE ID='{id}'"));

            if (string.IsNullOrEmpty(zbxtid))
            {
                //没有坐标系不计算
                return(false);
            }
            //获取坐标系的控制控制点坐标  //cl 2016/09/21 这里应是获取开挖坐标系
            DataSet ds = GCKWZBXTKBLL.GetKZDZBByZTXTID(zbxtid);

            if (ds.Tables[GCKWZBXTKModel.TableName].Rows.Count == 0)
            {
                //没有坐标系不计算
                return(false);
            }
            string ydid = ds.Tables[GCKWZBXTKModel.TableName].Rows[0][GCKWZBXTKModel.YDID].ToString();

            //if (!string.IsNullOrEmpty(ydid))
            //{
            if (string.IsNullOrEmpty(ydid))//修改 xyb,为什么是有值还不计算?
            {
                //没有原点坐标,不计算
                return(false);
            }
            string hzbid = ds.Tables[GCKWZBXTKModel.TableName].Rows[0][GCKWZBXTKModel.HZBID].ToString();

            if (string.IsNullOrEmpty(hzbid))
            {
                //没有x方向坐标,不计算
                return(false);
            }
            string zzbid = ds.Tables[GCKWZBXTKModel.TableName].Rows[0][GCKWZBXTKModel.ZZBID].ToString();

            if (string.IsNullOrEmpty(zzbid))
            {
                //没有y方向坐标,不计算
                return(false);
            }

            //开挖坐标系原点坐标
            DataRow drYD = ds.Tables[GCKZDZBKModel.TableName].Rows.Find(ydid);
            double  x    = double.Parse(drYD["X"].ToString());
            double  y    = double.Parse(drYD["Y"].ToString());
            double  z    = double.Parse(drYD["Z"].ToString());

            pts[0] = new sg_Vector3(x, y, z);

            //开挖坐标系X坐标
            DataRow hdr = ds.Tables[GCKZDZBKModel.TableName].Rows.Find(hzbid);

            x      = double.Parse(hdr["X"].ToString());
            y      = double.Parse(hdr["Y"].ToString());
            z      = double.Parse(hdr["Z"].ToString());
            pts[1] = new sg_Vector3(x, y, z);

            //开挖坐标系Y坐标
            DataRow zdr = ds.Tables[GCKZDZBKModel.TableName].Rows.Find(zzbid);

            x      = double.Parse(zdr["X"].ToString());
            y      = double.Parse(zdr["Y"].ToString());
            z      = double.Parse(zdr["Z"].ToString());
            pts[2] = new sg_Vector3(x, y, z);

            return(true);
        }
Ejemplo n.º 28
0
        public void CarryForward(List <ColumnInfo> _carryforwardParameters,
                                 List <ColumnInfo> _personalParameters)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    int CarryStartYear = Convert.ToDateTime(_carryforwardParameters[0].ColumnValue).Year;
                    int CarryEndYear   = Convert.ToDateTime(_carryforwardParameters[1].ColumnValue).Year;

                    List <vw_employment> lstStaff = null;
                    string sSqlStaff = string.Empty;


                    //期间内所有离职员工都不进行结转
                    atanaattBll bll = new atanaattBll();
                    bll.GetPersonals(_personalParameters, ref lstStaff, ref sSqlStaff, new DateTime(CarryEndYear, 12, 31).AddDays(1));

                    //得到休假类型
                    List <ColumnInfo> parameters = new List <ColumnInfo>()
                    {
                        new ColumnInfo()
                        {
                            ColumnName = "iscf", ColumnValue = "Y"
                        }
                    };
                    BaseBll          bBll         = new BaseBll();
                    List <tlvleatyp> lstLeaveType = bBll.GetSelectedRecords <tlvleatyp>(parameters);

                    for (int i = 0; i < (CarryEndYear - CarryStartYear) + 1; i++)
                    {
                        //结转前删除所有的结转年度数据

                        parameters = new List <ColumnInfo>()
                        {
                            new ColumnInfo()
                            {
                                ColumnName = "year", ColumnValue = (CarryStartYear + i).ToString()
                            }
                        };
                        dal.DoMultiDelete <tlvcryfwd>(parameters);


                        for (int n = 0; n < lstLeaveType.Count; n++)
                        {
                            string ltcd = lstLeaveType[n].ltcd;
                            for (int j = 0; j < lstStaff.Count; j++)
                            {
                                DoCarryforward(lstStaff[j], ltcd, CarryStartYear + i);
                            }
                        }
                    }

                    scope.Complete();
                }
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }