示例#1
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 <OverTimeInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <OverTimeInfo> list = new List <OverTimeInfo>();

            Query q = OverTime.CreateQuery();

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

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (OverTime overTime  in collection)
            {
                OverTimeInfo overTimeInfo = new OverTimeInfo();
                LoadFromDAL(overTimeInfo, overTime);
                list.Add(overTimeInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
示例#2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <OverTimeInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(OverTimeInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <OverTimeInfo>);
            }
            else
            {
                List <OverTimeInfo> list       = new List <OverTimeInfo>();
                OverTimeCollection  collection = new  OverTimeCollection();
                Query qry = new Query(OverTime.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (OverTime overTime in collection)
                {
                    OverTimeInfo overTimeInfo = new OverTimeInfo();
                    LoadFromDAL(overTimeInfo, overTime);
                    list.Add(overTimeInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(OverTimeInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
示例#3
0
        //数据持久化
        internal static void  SaveToDb(OverTimeInfo pOverTimeInfo, OverTime pOverTime, bool pIsNew)
        {
            pOverTime.OverTimeId  = pOverTimeInfo.overTimeId;
            pOverTime.ApplyDate   = pOverTimeInfo.applyDate;
            pOverTime.TimeFrom    = pOverTimeInfo.timeFrom;
            pOverTime.TimeTo      = pOverTimeInfo.timeTo;
            pOverTime.ApplyEmName = pOverTimeInfo.applyEmName;
            pOverTime.Reason      = pOverTimeInfo.reason;
            pOverTime.IsSubmit    = pOverTimeInfo.isSubmit;
            pOverTime.TimeSpan    = pOverTimeInfo.timeSpan;
            pOverTime.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pOverTime.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(OverTimeInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pOverTimeInfo.overTimeId = pOverTime.OverTimeId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(OverTimeInfo)))
            {
                ResetCache();
            }
        }
示例#4
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <OverTimeInfo> pList, OverTimeCollection pCollection)
 {
     foreach (OverTime overTime in pCollection)
     {
         OverTimeInfo overTimeInfo = new OverTimeInfo();
         LoadFromDAL(overTimeInfo, overTime);
         pList.Add(overTimeInfo);
     }
 }
示例#5
0
 protected void btnCancel_Click(object sender, EventArgs e)
 {
     OverTimeInfo ot = new OverTimeInfo(Convert.ToInt32(ViewState["OverTimeId"].ToString()));
     if (ot.IsSubmit.ToString() == "��ʼ��")
     {
         OverTimeInfo.DelGroupOfQt(Convert.ToInt32(ViewState["OverTimeId"].ToString()));
         OverTimeInfo.DelOverTime(Convert.ToInt32(ViewState["OverTimeId"].ToString()));
     }
     Response.Redirect("OverTimeEmgv.aspx");
 }
示例#6
0
 //从后台获取数据
 internal static void  LoadFromDAL(OverTimeInfo pOverTimeInfo, OverTime pOverTime)
 {
     pOverTimeInfo.overTimeId  = pOverTime.OverTimeId;
     pOverTimeInfo.applyDate   = pOverTime.ApplyDate;
     pOverTimeInfo.timeFrom    = pOverTime.TimeFrom;
     pOverTimeInfo.timeTo      = pOverTime.TimeTo;
     pOverTimeInfo.applyEmName = pOverTime.ApplyEmName;
     pOverTimeInfo.reason      = pOverTime.Reason;
     pOverTimeInfo.isSubmit    = pOverTime.IsSubmit;
     pOverTimeInfo.timeSpan    = pOverTime.TimeSpan;
     pOverTimeInfo.Loaded      = true;
 }
示例#7
0
 protected void PageBind()
 {
     int otid = Convert.ToInt32(Request["OverTimeId"].ToString());
     OverTimeInfo ot = new OverTimeInfo(otid);
     lblEmName.Text = ot.ApplyEmName.ToString();
     lblApplyEmName.Text = ot.ApplyEmName.ToString();
     lblTimeFrom.Text = ot.TimeFrom.ToString();
     lblTimeTo.Text = ot.TimeTo.ToString();
     lblReason.Text = ot.Reason.ToString();
     lblTimeSpan.Text = ot.TimeSpan.ToString();
     lblApplyDate.Text = ot.ApplyDate.ToString();
 }
示例#8
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(OverTimeInfo pOverTimeInfoFrom, OverTimeInfo pOverTimeInfoTo)
 {
     pOverTimeInfoTo.OverTimeId  = pOverTimeInfoFrom.overTimeId;
     pOverTimeInfoTo.ApplyDate   = pOverTimeInfoFrom.applyDate;
     pOverTimeInfoTo.TimeFrom    = pOverTimeInfoFrom.timeFrom;
     pOverTimeInfoTo.TimeTo      = pOverTimeInfoFrom.timeTo;
     pOverTimeInfoTo.ApplyEmName = pOverTimeInfoFrom.applyEmName;
     pOverTimeInfoTo.Reason      = pOverTimeInfoFrom.reason;
     pOverTimeInfoTo.IsSubmit    = pOverTimeInfoFrom.isSubmit;
     pOverTimeInfoTo.TimeSpan    = pOverTimeInfoFrom.timeSpan;
     pOverTimeInfoTo.Loaded      = pOverTimeInfoFrom.Loaded;
 }
示例#9
0
        public OverTimeInfo GetOverTimeInfoById(int OverTimeId)
        {
            OverTimeInfo overTimeInfo = null;             //

            try
            {
                overTimeInfo = new OverTimeInfo(OverTimeId);
            }
            catch (AppException)
            {
                return(null);
            }

            return(overTimeInfo);
        }
示例#10
0
        public OverTimeInfo GetOverTimeInfoById(int OverTimeId)
        {
            OverTimeInfo overTimeInfo  = null;//
            try
            {
                 overTimeInfo = new OverTimeInfo(OverTimeId);

            }
            catch (AppException)
            {
                return null;
            }

            return  overTimeInfo;
        }
示例#11
0
        protected void gvDataBind()
        {
            int otid = Convert.ToInt32(Request["OverTimeId"].ToString());
            OverTimeInfo ot = new OverTimeInfo(otid);

            DataTable dt = OverTimeInfo.getOtGroup(otid);

            if (dt.Rows.Count == 0)
            {
                dt.Rows.Add(dt.NewRow());
                UI.BindCtrl(dt.DefaultView, gvOtGroup, AspNetPager1);
                gvOtGroup.Rows[0].Visible = false;
            }
            else
            {
                UI.BindCtrl(dt.DefaultView, gvOtGroup, AspNetPager1);
            }
        }
示例#12
0
 private void LoadFromId(int overTimeId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(OverTimeInfo)))
     {
         OverTimeInfo overTimeInfo = Find(GetList(), overTimeId);
         if (overTimeInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(overTimeInfo, this);
     }
     else
     {
         OverTime overTime = new OverTime(overTimeId);
         if (overTime.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, overTime);
     }
 }
示例#13
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (gvOtGroup.Rows.Count != 0)
     {
         EmployeeInfo em = (EmployeeInfo)Session["Employee"];
         OverTimeInfo ot = new OverTimeInfo(Convert.ToInt32(ViewState["OverTimeId"].ToString()));
         ot.ApplyDate = txtApplyDate.Text.ToString();
         ot.ApplyEmName = em.EmployeeName.ToString();
         ot.IsSubmit = "����";
         ot.Reason = txtReason.Text.ToString();
         ot.TimeFrom = txtTimeFrom.Text.ToString();
         ot.TimeTo = txtTimeTo.Text.ToString();
         ot.TimeSpan = txtTimeSpan.Text.ToString();
         ot.Save();
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����ɹ���');</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�������Ӱ���Ա��¼��');</script>");
     }
 }
示例#14
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     int otid = Convert.ToInt32(Request["OverTimeId"].ToString());
     OverTimeInfo ot = new OverTimeInfo(otid);
     if (rblPass.SelectedValue == "1")
     {
         ot.IsSubmit = "ͨ��";
         ot.Save();
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�����ɹ���');</script>");
     }
     else if (rblPass.SelectedValue == "2")
     {
         ot.IsSubmit = "δͨ��";
         ot.Save();
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�����ɹ���');</script>");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('��ѡ���Ƿ�ͨ���ٱ��棡');</script>");
     }
 }
示例#15
0
        protected void gvOverTime_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");
                //�����������ָ����״Ϊ"С��"

                if (!Convert.IsDBNull(gvOverTime.DataKeys[e.Row.RowIndex].Value))
                {
                    int wkid = Convert.ToInt32(gvOverTime.DataKeys[e.Row.RowIndex].Value);
                    OverTimeInfo ot=new OverTimeInfo(wkid);
                    if (ot.IsSubmit == "δͨ��" || ot.IsSubmit == "ͨ��")
                    {
                        Button btnSubmit = e.Row.FindControl("btnSubmit") as Button;
                        btnSubmit.Enabled = false;
                    }
                }
            }
        }
示例#16
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<OverTimeInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(OverTimeInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< OverTimeInfo>;
     }
     else
     {
         List< OverTimeInfo>  list =new List< OverTimeInfo>();
         OverTimeCollection  collection=new  OverTimeCollection();
         Query qry = new Query(OverTime.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(OverTime overTime in collection)
         {
             OverTimeInfo overTimeInfo= new OverTimeInfo();
             LoadFromDAL(overTimeInfo,overTime);
             list.Add(overTimeInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(OverTimeInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
示例#17
0
 public void DeleteById(OverTimeInfo pOverTimeInfo)
 {
     OverTimeInfo overTimeInfo = new OverTimeInfo(pOverTimeInfo.OverTimeId);
     overTimeInfo.Delete();
 }
示例#18
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< OverTimeInfo> pList, OverTimeCollection pCollection)
 {
     foreach (OverTime overTime in pCollection)
     {
         OverTimeInfo overTimeInfo = new OverTimeInfo();
         LoadFromDAL(overTimeInfo, overTime );
         pList.Add(overTimeInfo);
     }
 }
示例#19
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(OverTimeInfo pOverTimeInfoTo)
 {
     Copy(this, pOverTimeInfoTo);
 }
示例#20
0
 //从后台获取数据
 internal static void LoadFromDAL(OverTimeInfo pOverTimeInfo, OverTime  pOverTime)
 {
     pOverTimeInfo.overTimeId = pOverTime.OverTimeId;
      		pOverTimeInfo.applyDate = pOverTime.ApplyDate;
      		pOverTimeInfo.timeFrom = pOverTime.TimeFrom;
      		pOverTimeInfo.timeTo = pOverTime.TimeTo;
      		pOverTimeInfo.applyEmName = pOverTime.ApplyEmName;
      		pOverTimeInfo.reason = pOverTime.Reason;
      		pOverTimeInfo.isSubmit = pOverTime.IsSubmit;
      		pOverTimeInfo.timeSpan = pOverTime.TimeSpan;
     pOverTimeInfo.Loaded=true;
 }
示例#21
0
 //数据持久化
 internal static void SaveToDb(OverTimeInfo pOverTimeInfo, OverTime  pOverTime,bool pIsNew)
 {
     pOverTime.OverTimeId = pOverTimeInfo.overTimeId;
      		pOverTime.ApplyDate = pOverTimeInfo.applyDate;
      		pOverTime.TimeFrom = pOverTimeInfo.timeFrom;
      		pOverTime.TimeTo = pOverTimeInfo.timeTo;
      		pOverTime.ApplyEmName = pOverTimeInfo.applyEmName;
      		pOverTime.Reason = pOverTimeInfo.reason;
      		pOverTime.IsSubmit = pOverTimeInfo.isSubmit;
      		pOverTime.TimeSpan = pOverTimeInfo.timeSpan;
     pOverTime.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pOverTime.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(OverTimeInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pOverTimeInfo.overTimeId = pOverTime.OverTimeId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(OverTimeInfo)))
     {
         ResetCache();
     }
 }
示例#22
0
 public object SaveOverTimeInfo(OverTimeInfo overTimeInfo)
 {
     overTimeInfo.Save();
     return overTimeInfo . OverTimeId;
 }
示例#23
0
 public List <OverTimeInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(OverTimeInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
示例#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<OverTimeInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< OverTimeInfo> list = new List< OverTimeInfo>();

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

            foreach (OverTime  overTime  in collection)
            {
                OverTimeInfo overTimeInfo = new OverTimeInfo();
                LoadFromDAL(overTimeInfo,   overTime);
                list.Add(overTimeInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
示例#25
0
        public void DeleteById(OverTimeInfo pOverTimeInfo)
        {
            OverTimeInfo overTimeInfo = new OverTimeInfo(pOverTimeInfo.OverTimeId);

            overTimeInfo.Delete();
        }
示例#26
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(OverTimeInfo pOverTimeInfoFrom, OverTimeInfo pOverTimeInfoTo)
 {
     pOverTimeInfoTo.OverTimeId = pOverTimeInfoFrom.overTimeId;
      		pOverTimeInfoTo.ApplyDate = pOverTimeInfoFrom.applyDate;
      		pOverTimeInfoTo.TimeFrom = pOverTimeInfoFrom.timeFrom;
      		pOverTimeInfoTo.TimeTo = pOverTimeInfoFrom.timeTo;
      		pOverTimeInfoTo.ApplyEmName = pOverTimeInfoFrom.applyEmName;
      		pOverTimeInfoTo.Reason = pOverTimeInfoFrom.reason;
      		pOverTimeInfoTo.IsSubmit = pOverTimeInfoFrom.isSubmit;
      		pOverTimeInfoTo.TimeSpan = pOverTimeInfoFrom.timeSpan;
     pOverTimeInfoTo.Loaded=pOverTimeInfoFrom.Loaded;
 }
示例#27
0
 public List <OverTimeInfo> GetOverTimeInfoList()
 {
     return(OverTimeInfo.GetList());
 }
示例#28
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(OverTimeInfo pOverTimeInfoTo)
 {
     Copy(this,  pOverTimeInfoTo);
 }
示例#29
0
 public object  SaveOverTimeInfo(OverTimeInfo overTimeInfo)
 {
     overTimeInfo.Save();
     return(overTimeInfo.OverTimeId);
 }
示例#30
0
        protected void PageInit()
        {
            EmployeeInfo em = (EmployeeInfo)Session["Employee"];
            lblApplyEmName.Text = em.EmployeeName.ToString();

            OverTimeInfo ot = new OverTimeInfo();
            ot.IsSubmit = "��ʼ��";
            ot.Save();
            ViewState["OverTimeId"] = ot.OverTimeId;
        }