Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <HolidayApplyInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(HolidayApplyInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <HolidayApplyInfo>);
            }
            else
            {
                List <HolidayApplyInfo> list       = new List <HolidayApplyInfo>();
                HolidayApplyCollection  collection = new  HolidayApplyCollection();
                Query qry = new Query(HolidayApply.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (HolidayApply holidayApply in collection)
                {
                    HolidayApplyInfo holidayApplyInfo = new HolidayApplyInfo();
                    LoadFromDAL(holidayApplyInfo, holidayApply);
                    list.Add(holidayApplyInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(HolidayApplyInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <HolidayApplyInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <HolidayApplyInfo> list = new List <HolidayApplyInfo>();

            Query q = HolidayApply.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            HolidayApplyCollection collection = new  HolidayApplyCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (HolidayApply holidayApply  in collection)
            {
                HolidayApplyInfo holidayApplyInfo = new HolidayApplyInfo();
                LoadFromDAL(holidayApplyInfo, holidayApply);
                list.Add(holidayApplyInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
Esempio n. 3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
                {

                    int hoid = Convert.ToInt32(Request["HolidayApplyId"].ToString());
                    HolidayApplyInfo holiday=new HolidayApplyInfo(hoid);

                            holiday.ApplyDate = txtApplyDate.Text.ToString();
                            holiday.Company1 = lblCompany.Text.ToString();
                            holiday.PositonName = lblPosition.Text.ToString();
                            holiday.Company2 = txtApplyCompany.Text.ToString();
                            holiday.Company2Name = txtApplyName.Text.ToString();
                            holiday.HolidayTypeId = Convert.ToInt32(rblHoliydayType.SelectedValue.ToString());
                            holiday.BeginTime = txtBeginTime.Text.ToString();
                            holiday.EndTime = txtEndTime.Text.ToString();
                            holiday.TimeSum = txtTimeSum.Text.ToString();
                            holiday.Reason = txtReason.Text.ToString();
                            holiday.SectionView = txtUperView.Text.ToString();
                            holiday.HrView = txtHrView.Text.ToString();
                            holiday.ManagerView = txtManagerView.Text.ToString();
                            holiday.Memo = txtMemo.Text.ToString();
                            holiday.Save();
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�༭�ɹ���');</script>");

                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + Ex.Message + "');", true);
                }
        }
Esempio n. 4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {
                    int hoid = Convert.ToInt32(Request["HolidayApplyId"].ToString());
                    HolidayApplyInfo holiday = new HolidayApplyInfo(hoid);
                    holiday.SectionView = txtUperView.Text.ToString();
                    if (rblOver.Items[0].Selected)
                    {
                        holiday.State = 2;
                        holiday.Save();
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>");

                    }
                    else if (rblOver.Items[1].Selected)
                    {
                        holiday.State = 3;
                        holiday.Save();
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('审批通过!');</script>");

                    }

                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true);
                }
            }
        }
Esempio n. 5
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     int hid = Convert.ToInt32(((Button)sender).CommandArgument.ToString());
     HolidayApplyInfo ha = new HolidayApplyInfo(hid);
     ha.State = 3;
     ha.ApplyTime = DateTime.Now.ToString();
     ha.Save();
     gvDataBind();
 }
Esempio n. 6
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <HolidayApplyInfo> pList, HolidayApplyCollection pCollection)
 {
     foreach (HolidayApply holidayApply in pCollection)
     {
         HolidayApplyInfo holidayApplyInfo = new HolidayApplyInfo();
         LoadFromDAL(holidayApplyInfo, holidayApply);
         pList.Add(holidayApplyInfo);
     }
 }
Esempio n. 7
0
        protected void gvHoliday_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //鼠标移动到每项时颜色交替效果
                e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
                //设置悬浮鼠标指针形状为"小手"
                e.Row.Attributes["style"] = "Cursor:hand";

                if (!Convert.IsDBNull(gvHoliday.DataKeys[e.Row.RowIndex].Value))
                {
                    int hid = Convert.ToInt32(gvHoliday.DataKeys[e.Row.RowIndex].Value);
                    HolidayApplyInfo ha = new HolidayApplyInfo(hid);

                    if (ha.State != 0)
                    {
                        Button btnSubmit = e.Row.FindControl("btnSubmit") as Button;
                        Button btnEdit = e.Row.FindControl("btnEdit") as Button;
                        Button btnDelete = e.Row.FindControl("btnDelete") as Button;
                        btnSubmit.Enabled = false;
                        btnEdit.Enabled = false;
                        btnDelete.Enabled = false;
                    }

                    Label lblState = e.Row.FindControl("lblState") as Label;

                    switch (ha.State)
                    {
                        case 0:
                            lblState.Text = "未提交";
                            break;
                        case 1:
                            lblState.Text = "待部门领导审批";
                            break;
                        case 2:
                            lblState.Text = "部门:修正";
                            break;
                        case 3:
                            lblState.Text = "待总经理审批";
                            break;
                        case 4:
                            lblState.Text = "通过";
                            break;
                        case 5:
                            lblState.Text = "总经理:修正";
                            break;
                        default:
                            lblState.Text = "其他状态";
                            break;
                    }
                }
            }
        }
        public HolidayApplyInfo GetHolidayApplyInfoById(int HolidayApplyId)
        {
            HolidayApplyInfo holidayApplyInfo  = null;//
            try
            {
                 holidayApplyInfo = new HolidayApplyInfo(HolidayApplyId);

            }
            catch (AppException)
            {
                return null;
            }

            return  holidayApplyInfo;
        }
Esempio n. 9
0
        public HolidayApplyInfo GetHolidayApplyInfoById(int HolidayApplyId)
        {
            HolidayApplyInfo holidayApplyInfo = null;             //

            try
            {
                holidayApplyInfo = new HolidayApplyInfo(HolidayApplyId);
            }
            catch (AppException)
            {
                return(null);
            }

            return(holidayApplyInfo);
        }
Esempio n. 10
0
        protected void PageInit()
        {
            int hoid = Convert.ToInt32(Request["HolidayApplyId"].ToString());
            HolidayApplyInfo holiday = new HolidayApplyInfo(hoid);

            txtApplyDate.Text = holiday.ApplyDate.ToString();
            lblPosition.Text = holiday.PositonName.ToString();
            lblEmployeeName.Text = holiday.ApplyName.ToString();
            txtApplyCompany.Text = holiday.Company2.ToString();
            txtApplyName.Text = holiday.Company2Name.ToString();
            rblHoliydayType.SelectedValue = holiday.HolidayTypeId.ToString();
            txtBeginTime.Text = holiday.BeginTime.ToString();
            txtEndTime.Text = holiday.EndTime.ToString();
            txtTimeSum.Text = holiday.TimeSum.ToString();
            txtReason.Text = holiday.Reason.ToString();
            txtUperView.Text = holiday.SectionView.ToString();
            txtMemo.Text = holiday.Memo.ToString();
        }
Esempio n. 11
0
        //数据持久化
        internal static void  SaveToDb(HolidayApplyInfo pHolidayApplyInfo, HolidayApply pHolidayApply, bool pIsNew)
        {
            pHolidayApply.HolidayApplyId = pHolidayApplyInfo.holidayApplyId;
            pHolidayApply.Company1       = pHolidayApplyInfo.company1;
            pHolidayApply.PositonName    = pHolidayApplyInfo.positonName;
            pHolidayApply.Company2       = pHolidayApplyInfo.company2;
            pHolidayApply.Company2Name   = pHolidayApplyInfo.company2Name;
            pHolidayApply.HolidayTypeId  = pHolidayApplyInfo.holidayTypeId;
            pHolidayApply.BeginTime      = pHolidayApplyInfo.beginTime;
            pHolidayApply.EndTime        = pHolidayApplyInfo.endTime;
            pHolidayApply.TimeSum        = pHolidayApplyInfo.timeSum;
            pHolidayApply.Reason         = pHolidayApplyInfo.reason;
            pHolidayApply.SectionView    = pHolidayApplyInfo.sectionView;
            pHolidayApply.HrView         = pHolidayApplyInfo.hrView;
            pHolidayApply.ManagerView    = pHolidayApplyInfo.managerView;
            pHolidayApply.Memo           = pHolidayApplyInfo.memo;
            pHolidayApply.ApplyDate      = pHolidayApplyInfo.applyDate;
            pHolidayApply.ApplyTime      = pHolidayApplyInfo.applyTime;
            pHolidayApply.ApplyName      = pHolidayApplyInfo.applyName;
            pHolidayApply.DepartName     = pHolidayApplyInfo.departName;
            pHolidayApply.State          = pHolidayApplyInfo.state;
            pHolidayApply.IsNew          = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pHolidayApply.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(HolidayApplyInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pHolidayApplyInfo.holidayApplyId = pHolidayApply.HolidayApplyId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(HolidayApplyInfo)))
            {
                ResetCache();
            }
        }
Esempio n. 12
0
 private void LoadFromId(int holidayApplyId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(HolidayApplyInfo)))
     {
         HolidayApplyInfo holidayApplyInfo = Find(GetList(), holidayApplyId);
         if (holidayApplyInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(holidayApplyInfo, this);
     }
     else
     {
         HolidayApply holidayApply = new HolidayApply(holidayApplyId);
         if (holidayApply.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, holidayApply);
     }
 }
Esempio n. 13
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(HolidayApplyInfo pHolidayApplyInfoFrom, HolidayApplyInfo pHolidayApplyInfoTo)
 {
     pHolidayApplyInfoTo.HolidayApplyId = pHolidayApplyInfoFrom.holidayApplyId;
     pHolidayApplyInfoTo.Company1       = pHolidayApplyInfoFrom.company1;
     pHolidayApplyInfoTo.PositonName    = pHolidayApplyInfoFrom.positonName;
     pHolidayApplyInfoTo.Company2       = pHolidayApplyInfoFrom.company2;
     pHolidayApplyInfoTo.Company2Name   = pHolidayApplyInfoFrom.company2Name;
     pHolidayApplyInfoTo.HolidayTypeId  = pHolidayApplyInfoFrom.holidayTypeId;
     pHolidayApplyInfoTo.BeginTime      = pHolidayApplyInfoFrom.beginTime;
     pHolidayApplyInfoTo.EndTime        = pHolidayApplyInfoFrom.endTime;
     pHolidayApplyInfoTo.TimeSum        = pHolidayApplyInfoFrom.timeSum;
     pHolidayApplyInfoTo.Reason         = pHolidayApplyInfoFrom.reason;
     pHolidayApplyInfoTo.SectionView    = pHolidayApplyInfoFrom.sectionView;
     pHolidayApplyInfoTo.HrView         = pHolidayApplyInfoFrom.hrView;
     pHolidayApplyInfoTo.ManagerView    = pHolidayApplyInfoFrom.managerView;
     pHolidayApplyInfoTo.Memo           = pHolidayApplyInfoFrom.memo;
     pHolidayApplyInfoTo.ApplyDate      = pHolidayApplyInfoFrom.applyDate;
     pHolidayApplyInfoTo.ApplyTime      = pHolidayApplyInfoFrom.applyTime;
     pHolidayApplyInfoTo.ApplyName      = pHolidayApplyInfoFrom.applyName;
     pHolidayApplyInfoTo.DepartName     = pHolidayApplyInfoFrom.departName;
     pHolidayApplyInfoTo.State          = pHolidayApplyInfoFrom.state;
     pHolidayApplyInfoTo.Loaded         = pHolidayApplyInfoFrom.Loaded;
 }
Esempio n. 14
0
 //从后台获取数据
 internal static void  LoadFromDAL(HolidayApplyInfo pHolidayApplyInfo, HolidayApply pHolidayApply)
 {
     pHolidayApplyInfo.holidayApplyId = pHolidayApply.HolidayApplyId;
     pHolidayApplyInfo.company1       = pHolidayApply.Company1;
     pHolidayApplyInfo.positonName    = pHolidayApply.PositonName;
     pHolidayApplyInfo.company2       = pHolidayApply.Company2;
     pHolidayApplyInfo.company2Name   = pHolidayApply.Company2Name;
     pHolidayApplyInfo.holidayTypeId  = pHolidayApply.HolidayTypeId;
     pHolidayApplyInfo.beginTime      = pHolidayApply.BeginTime;
     pHolidayApplyInfo.endTime        = pHolidayApply.EndTime;
     pHolidayApplyInfo.timeSum        = pHolidayApply.TimeSum;
     pHolidayApplyInfo.reason         = pHolidayApply.Reason;
     pHolidayApplyInfo.sectionView    = pHolidayApply.SectionView;
     pHolidayApplyInfo.hrView         = pHolidayApply.HrView;
     pHolidayApplyInfo.managerView    = pHolidayApply.ManagerView;
     pHolidayApplyInfo.memo           = pHolidayApply.Memo;
     pHolidayApplyInfo.applyDate      = pHolidayApply.ApplyDate;
     pHolidayApplyInfo.applyTime      = pHolidayApply.ApplyTime;
     pHolidayApplyInfo.applyName      = pHolidayApply.ApplyName;
     pHolidayApplyInfo.departName     = pHolidayApply.DepartName;
     pHolidayApplyInfo.state          = pHolidayApply.State;
     pHolidayApplyInfo.Loaded         = true;
 }
Esempio n. 15
0
 public List <HolidayApplyInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(HolidayApplyInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
Esempio n. 16
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(HolidayApplyInfo pHolidayApplyInfoTo)
 {
     Copy(this,  pHolidayApplyInfoTo);
 }
Esempio n. 17
0
 public List <HolidayApplyInfo> GetHolidayApplyInfoList()
 {
     return(HolidayApplyInfo.GetList());
 }
 public object SaveHolidayApplyInfo(HolidayApplyInfo holidayApplyInfo)
 {
     holidayApplyInfo.Save();
     return holidayApplyInfo . HolidayApplyId;
 }
Esempio n. 19
0
        public void DeleteById(HolidayApplyInfo pHolidayApplyInfo)
        {
            HolidayApplyInfo holidayApplyInfo = new HolidayApplyInfo(pHolidayApplyInfo.HolidayApplyId);

            holidayApplyInfo.Delete();
        }
 public void DeleteById(HolidayApplyInfo pHolidayApplyInfo)
 {
     HolidayApplyInfo holidayApplyInfo = new HolidayApplyInfo(pHolidayApplyInfo.HolidayApplyId);
     holidayApplyInfo.Delete();
 }
Esempio n. 21
0
 //从后台获取数据
 internal static void LoadFromDAL(HolidayApplyInfo pHolidayApplyInfo, HolidayApply  pHolidayApply)
 {
     pHolidayApplyInfo.holidayApplyId = pHolidayApply.HolidayApplyId;
      		pHolidayApplyInfo.company1 = pHolidayApply.Company1;
      		pHolidayApplyInfo.positonName = pHolidayApply.PositonName;
      		pHolidayApplyInfo.company2 = pHolidayApply.Company2;
      		pHolidayApplyInfo.company2Name = pHolidayApply.Company2Name;
      		pHolidayApplyInfo.holidayTypeId = pHolidayApply.HolidayTypeId;
      		pHolidayApplyInfo.beginTime = pHolidayApply.BeginTime;
      		pHolidayApplyInfo.endTime = pHolidayApply.EndTime;
      		pHolidayApplyInfo.timeSum = pHolidayApply.TimeSum;
      		pHolidayApplyInfo.reason = pHolidayApply.Reason;
      		pHolidayApplyInfo.sectionView = pHolidayApply.SectionView;
      		pHolidayApplyInfo.hrView = pHolidayApply.HrView;
      		pHolidayApplyInfo.managerView = pHolidayApply.ManagerView;
      		pHolidayApplyInfo.memo = pHolidayApply.Memo;
      		pHolidayApplyInfo.applyDate = pHolidayApply.ApplyDate;
      		pHolidayApplyInfo.applyTime = pHolidayApply.ApplyTime;
      		pHolidayApplyInfo.applyName = pHolidayApply.ApplyName;
      		pHolidayApplyInfo.departName = pHolidayApply.DepartName;
      		pHolidayApplyInfo.state = pHolidayApply.State;
     pHolidayApplyInfo.Loaded=true;
 }
Esempio n. 22
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(HolidayApplyInfo pHolidayApplyInfoTo)
 {
     Copy(this, pHolidayApplyInfoTo);
 }
Esempio n. 23
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< HolidayApplyInfo> pList, HolidayApplyCollection pCollection)
 {
     foreach (HolidayApply holidayApply in pCollection)
     {
         HolidayApplyInfo holidayApplyInfo = new HolidayApplyInfo();
         LoadFromDAL(holidayApplyInfo, holidayApply );
         pList.Add(holidayApplyInfo);
     }
 }
Esempio n. 24
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<HolidayApplyInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< HolidayApplyInfo> list = new List< HolidayApplyInfo>();

            Query q = HolidayApply .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            HolidayApplyCollection  collection=new  HolidayApplyCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (HolidayApply  holidayApply  in collection)
            {
                HolidayApplyInfo holidayApplyInfo = new HolidayApplyInfo();
                LoadFromDAL(holidayApplyInfo,   holidayApply);
                list.Add(holidayApplyInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Esempio n. 25
0
 public object  SaveHolidayApplyInfo(HolidayApplyInfo holidayApplyInfo)
 {
     holidayApplyInfo.Save();
     return(holidayApplyInfo.HolidayApplyId);
 }
Esempio n. 26
0
 //数据持久化
 internal static void SaveToDb(HolidayApplyInfo pHolidayApplyInfo, HolidayApply  pHolidayApply,bool pIsNew)
 {
     pHolidayApply.HolidayApplyId = pHolidayApplyInfo.holidayApplyId;
      		pHolidayApply.Company1 = pHolidayApplyInfo.company1;
      		pHolidayApply.PositonName = pHolidayApplyInfo.positonName;
      		pHolidayApply.Company2 = pHolidayApplyInfo.company2;
      		pHolidayApply.Company2Name = pHolidayApplyInfo.company2Name;
      		pHolidayApply.HolidayTypeId = pHolidayApplyInfo.holidayTypeId;
      		pHolidayApply.BeginTime = pHolidayApplyInfo.beginTime;
      		pHolidayApply.EndTime = pHolidayApplyInfo.endTime;
      		pHolidayApply.TimeSum = pHolidayApplyInfo.timeSum;
      		pHolidayApply.Reason = pHolidayApplyInfo.reason;
      		pHolidayApply.SectionView = pHolidayApplyInfo.sectionView;
      		pHolidayApply.HrView = pHolidayApplyInfo.hrView;
      		pHolidayApply.ManagerView = pHolidayApplyInfo.managerView;
      		pHolidayApply.Memo = pHolidayApplyInfo.memo;
      		pHolidayApply.ApplyDate = pHolidayApplyInfo.applyDate;
      		pHolidayApply.ApplyTime = pHolidayApplyInfo.applyTime;
      		pHolidayApply.ApplyName = pHolidayApplyInfo.applyName;
      		pHolidayApply.DepartName = pHolidayApplyInfo.departName;
      		pHolidayApply.State = pHolidayApplyInfo.state;
     pHolidayApply.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pHolidayApply.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(HolidayApplyInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pHolidayApplyInfo.holidayApplyId = pHolidayApply.HolidayApplyId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(HolidayApplyInfo)))
     {
         ResetCache();
     }
 }
Esempio n. 27
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(HolidayApplyInfo pHolidayApplyInfoFrom, HolidayApplyInfo pHolidayApplyInfoTo)
 {
     pHolidayApplyInfoTo.HolidayApplyId = pHolidayApplyInfoFrom.holidayApplyId;
      		pHolidayApplyInfoTo.Company1 = pHolidayApplyInfoFrom.company1;
      		pHolidayApplyInfoTo.PositonName = pHolidayApplyInfoFrom.positonName;
      		pHolidayApplyInfoTo.Company2 = pHolidayApplyInfoFrom.company2;
      		pHolidayApplyInfoTo.Company2Name = pHolidayApplyInfoFrom.company2Name;
      		pHolidayApplyInfoTo.HolidayTypeId = pHolidayApplyInfoFrom.holidayTypeId;
      		pHolidayApplyInfoTo.BeginTime = pHolidayApplyInfoFrom.beginTime;
      		pHolidayApplyInfoTo.EndTime = pHolidayApplyInfoFrom.endTime;
      		pHolidayApplyInfoTo.TimeSum = pHolidayApplyInfoFrom.timeSum;
      		pHolidayApplyInfoTo.Reason = pHolidayApplyInfoFrom.reason;
      		pHolidayApplyInfoTo.SectionView = pHolidayApplyInfoFrom.sectionView;
      		pHolidayApplyInfoTo.HrView = pHolidayApplyInfoFrom.hrView;
      		pHolidayApplyInfoTo.ManagerView = pHolidayApplyInfoFrom.managerView;
      		pHolidayApplyInfoTo.Memo = pHolidayApplyInfoFrom.memo;
      		pHolidayApplyInfoTo.ApplyDate = pHolidayApplyInfoFrom.applyDate;
      		pHolidayApplyInfoTo.ApplyTime = pHolidayApplyInfoFrom.applyTime;
      		pHolidayApplyInfoTo.ApplyName = pHolidayApplyInfoFrom.applyName;
      		pHolidayApplyInfoTo.DepartName = pHolidayApplyInfoFrom.departName;
      		pHolidayApplyInfoTo.State = pHolidayApplyInfoFrom.state;
     pHolidayApplyInfoTo.Loaded=pHolidayApplyInfoFrom.Loaded;
 }
Esempio n. 28
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<HolidayApplyInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(HolidayApplyInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< HolidayApplyInfo>;
     }
     else
     {
         List< HolidayApplyInfo>  list =new List< HolidayApplyInfo>();
         HolidayApplyCollection  collection=new  HolidayApplyCollection();
         Query qry = new Query(HolidayApply.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(HolidayApply holidayApply in collection)
         {
             HolidayApplyInfo holidayApplyInfo= new HolidayApplyInfo();
             LoadFromDAL(holidayApplyInfo,holidayApply);
             list.Add(holidayApplyInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(HolidayApplyInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }