Exemple #1
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            string sql = @"select B.GroupID As CorpId ,B.Name As CorpName from sysuser As A 
	                       left join SysGroup As B
                             on A.Pk_corp=B.GroupID
	                       where A.UserID='{0}' "    ;

            sql = string.Format(sql, UserInfo.UserID);
            DataTable Dt = DataHelper.QueryDataTable(sql);

            CommPowerSplit ps = new CommPowerSplit();

            if (ps.IsHR(UserInfo.UserID, UserInfo.LoginName) || ps.IsSetMgrRole(UserInfo.UserID, UserInfo.LoginName)) //设置管理角色 or HR
            {
                ents = WelfareConfig.FindAll(SearchCriterion);
            }
            else
            {
                string  CorpIds = string.Empty;
                SysUser Ent     = SysUser.Find(UserInfo.UserID);

                // 判断公司登陆
                if (Session["CompanyId"] != null)
                {
                    CorpIds = Session["CompanyId"] + "";
                }
                else
                {
                    CorpIds = Ent.Pk_corp;
                }
                ents = WelfareConfig.FindAll(SearchCriterion, Expression.Sql("CorpId='" + CorpIds + "' or CreateId='" + UserInfo.UserID + "' "));
            }

            this.PageState.Add("DataList", ents);
        }
Exemple #2
0
        private void btnSave()
        {
            IList <string> entStrList = RequestData.GetList <string>("data");

            if (entStrList != null && entStrList.Count > 0)
            {
                IList <WelfareConfig> ents = entStrList.Select(tent => JsonHelper.GetObject <WelfareConfig>(tent) as WelfareConfig).ToList();

                foreach (WelfareConfig ent in ents)
                {
                    if (ent != null)
                    {
                        WelfareConfig tent = ent;

                        if (String.IsNullOrEmpty(tent.Id))
                        {
                            tent.CreateId   = UserInfo.UserID;
                            tent.CreateName = UserInfo.Name;
                        }
                        else
                        {
                            tent = DataHelper.MergeData(WelfareConfig.Find(tent.Id), tent);
                        }

                        tent.DoSave();
                    }
                }
            }
        }
        /// <summary>
        ///  获取剩余的名额 "" 无限制, 负 超过限额
        /// </summary>
        /// <param name="ConfigId"></param>
        /// <returns></returns>
        private string GetRemainCout(string ConfigId)
        {
            string LevelUsre = string.Empty;
            var    Ent       = WelfareConfig.TryFind(ConfigId);

            if (Ent != null)
            {
                if (Ent.TravelCount.GetValueOrDefault() > 0)
                {
                    string sql = @" select Sum(T) As Cout from 
                            (
	                            select count(*) As T from  FL_Culture..UsrTravelWelfare As A where ConfigSetId='{0}' 
	                            union All
	                            select Count(*) As T from  FL_Culture..UsrTravelWelfare As A
	                            inner join  FL_Culture..UsrTravelInfo As B 
	                            on A.Id=B.WelfareTravelId 
	                            where ConfigSetId='{0}'
                            )As T ";
                    sql = string.Format(sql, ConfigId);
                    int FillUsr = DataHelper.QueryValue <int>(sql);

                    LevelUsre = (Ent.TravelCount.GetValueOrDefault() - FillUsr).ToString();
                }
            }
            return(LevelUsre);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WelfareConfig ent = null;

            switch (RequestActionString)
            {
            case "Save":
                DoSave();
                break;

            case "Update":
                DoUpdate();
                break;

            default:
                //if (RequestActionString == "GetAusrId")
                //{
                //    string CoupleAcceptUsrId = RequestData.Get("CoupleAcceptUsrId") + "";
                //    ComUtility Ut = new ComUtility();
                //    this.PageState.Add("GetAusrId", Ut.GetWorkNo(CoupleAcceptUsrId));
                //}
                DoSelect();
                break;
            }
        }
Exemple #5
0
        private void DoBatchDelete()
        {
            IList <object> idList = RequestData.GetList <object>("IdList");

            if (idList != null && idList.Count > 0)
            {
                WelfareConfig.DoBatchDelete(idList.ToArray());
            }
        }
Exemple #6
0
        /// <summary>
        /// 福利相关配置
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        public static void UpdateWelfareConfig(List <SystemGolbalConfigCacheModel> values = null)
        {
            values = values ?? CacheCollection.SystemGolbalConfigCache.Value();

            var remindTime = values?.FirstOrDefault(p => p.ResourceType == (int)GlobalConfigType.Time && p.ResourceKey == (int)GlobalTimeConfigOption.WelfareApplyRemind);

            WelfareConfig = new WelfareConfig
            {
                BeforeRemindMinutes = remindTime != null?GetMinutes(remindTime.Value, remindTime.ValueUnit) : 10
            };
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WelfareConfig ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <WelfareConfig>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    DoBatchDelete();
                }
                else if (RequestActionString == "batchsave")
                {
                    btnSave();
                }
                else if (RequestActionString == "SaveItem")
                {
                    SaveItem();
                }
                else if (RequestActionString == "GetID")
                {
                    //string strGUID = System.Guid.NewGuid().ToString();
                    //string sql = " select * from FL_Culture..WelfareConfig where Id='" + strGUID + "'";
                    //DataTable dt = DataHelper.QueryDataTable(sql);
                    //while (dt.Rows.Count != 0)
                    //{
                    //    strGUID = System.Guid.NewGuid().ToString();
                    //    sql = " select * from FL_Culture..WelfareConfig where Id='" + strGUID + "'";
                    //    dt = DataHelper.QueryDataTable(sql);
                    //}
                    WelfareConfig Ent = new WelfareConfig();
                    Ent.Create();
                    this.PageState.Add("thisid", Ent.Id);
                }
                else if (RequestActionString == "ISEnable")
                {
                    string ISEnable = RequestData.Get <string>("Enable");
                    string ID       = RequestData.Get <string>("ID");
                    string sql      = " update  FL_Culture..WelfareConfig set ISEnable='" + ISEnable + "' where Id in(" + ID + ")";
                    DataHelper.ExecSql(sql);
                }
                else
                {
                    DoSelect();
                }
                break;
            }
        }
        private void DoSave()
        {
            WelfareConfig ent = this.GetPostedData <WelfareConfig>();

            ent.DoCreate();
            this.PageState.Add("Id", ent.Id);
            //string CouponCost = this.RequestData.Get("CouponCost") + "";
            //string MarryCheckCost = this.RequestData.Get("MarryCheckCost") + "";
            //string NoMarryCheckCost = this.RequestData.Get("NoMarryCheckCost") + "";
            //WelfareConfig Ent = new WelfareConfig();
            //Ent.CouponCost = decimal.Parse(CouponCost);
            //Ent.MarryCheckCost = decimal.Parse(MarryCheckCost);
            //Ent.NoMarryCheckCost = decimal.Parse();
        }
Exemple #9
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            WelfareConfig ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <WelfareConfig>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <WelfareConfig>();

                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <WelfareConfig>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = WelfareConfig.Find(id);
                }

                this.SetFormData(ent);
            }
        }
Exemple #10
0
    private void SetWdt(List <ConfigDada> list)
    {
        int con = list == null ? 0 : list.Count;

        for (int i = 0; i < con; i++)
        {
            WelfareConfig config = list[i] as WelfareConfig;
            if (config != null)
            {
                GameObject tex;
                tex = Instantiate(texItem, mTran.transform) as GameObject;
                if (tex != null)
                {
                    tex.SetActive(true);
                    Assets.LoadIcon(config.texUrel, (t) => tex.GetComponent <UITexture>().mainTexture = t);
                    objs.Add(tex);
                }
            }
        }
        mTran.GetComponent <UIGrid>().Reposition();
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid = RequestData.Get("userid") + "";

            if (!string.IsNullOrEmpty(uid))
            {
                UserId   = uid;
                UserEnt  = SysUser.TryFind(uid);
                UserName = UserEnt.Name;
            }
            else
            {
                UserId   = UserInfo.UserID;
                UserEnt  = SysUser.TryFind(UserInfo.UserID);
                UserName = UserInfo.LoginName;
            }

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            GetMyTravelMoney(); //获取旅游金额

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                DoUpdate();
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                DoCreate();
                break;

            default:
                if (RequestActionString == "DeleteSub")
                {
                    DelFamilyMember();
                }
                else if (RequestActionString == "GetTimeSeg")     //获取时间段
                {
                    string CorpId = string.Empty, DeptId = string.Empty;
                    string Addr = RequestData.Get("Addr") + "";

                    if (Session["CompanyId"] != null)
                    {
                        CorpId = Session["CompanyId"] + "";
                    }
                    else
                    {
                        CorpId = UserEnt.Pk_corp;
                    }
                    DeptId = UserEnt.Pk_deptdoc;
                    this.PageState.Add("Result", GetTimeSegEnum(CorpId, DeptId, Addr));
                }
                else if (RequestActionString == "GetUsrCount")     //获取人员名额
                {
                    string configId = RequestData.Get("ConfigSetId") + "";
                    this.PageState.Add("Result", GetRemainCout(configId));
                }
                else if (RequestActionString == "GetDetailInfo")
                {
                    string CorpId = string.Empty, DeptId = string.Empty;
                    string Addr    = RequestData.Get("Addr") + "";
                    string TimeSeg = RequestData.Get("TimeSeg") + "";

                    if (Session["CompanyId"] != null)
                    {
                        CorpId = Session["CompanyId"] + "";
                    }
                    else
                    {
                        CorpId = UserEnt.Pk_corp;
                    }
                    DeptId = UserEnt.Pk_deptdoc;
                    this.PageState.Add("Result", GetUserCount(CorpId, DeptId, Addr, TimeSeg));
                }
                else if (RequestActionString == "GetTravelConfig")
                {
                    string        ConfigId = RequestData.Get("ConifgId") + "";
                    WelfareConfig Ent      = Model.WelfareConfig.TryFind(ConfigId);
                    this.PageState.Add("Info", Ent == null ? (object)"" : Ent);
                }
                else if (RequestActionString == "doAppSubmit")
                {
                    doAppSubmit();
                }
                else
                {
                    DoSelect();
                }
                break;
            }
        }
        private void DoUpdate()
        {
            WelfareConfig ent = this.GetMergedData <WelfareConfig>();

            ent.DoUpdate();
        }