예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <WeekSumInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(WeekSumInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <WeekSumInfo>);
            }
            else
            {
                List <WeekSumInfo> list       = new List <WeekSumInfo>();
                WeekSumCollection  collection = new  WeekSumCollection();
                Query qry = new Query(WeekSum.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (WeekSum weekSum in collection)
                {
                    WeekSumInfo weekSumInfo = new WeekSumInfo();
                    LoadFromDAL(weekSumInfo, weekSum);
                    list.Add(weekSumInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(WeekSumInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
예제 #2
0
        //数据持久化
        internal static void  SaveToDb(WeekSumInfo pWeekSumInfo, WeekSum pWeekSum, bool pIsNew)
        {
            pWeekSum.WeekSumId      = pWeekSumInfo.weekSumId;
            pWeekSum.WeekSumName    = pWeekSumInfo.weekSumName;
            pWeekSum.IsApprove      = pWeekSumInfo.isApprove;
            pWeekSum.IsApply        = pWeekSumInfo.isApply;
            pWeekSum.IsSend         = pWeekSumInfo.isSend;
            pWeekSum.ApplyTime      = pWeekSumInfo.applyTime;
            pWeekSum.RepplyTime     = pWeekSumInfo.repplyTime;
            pWeekSum.ApplyView      = pWeekSumInfo.applyView;
            pWeekSum.SendEmployeeId = pWeekSumInfo.sendEmployeeId;
            pWeekSum.RecvEmployeeId = pWeekSumInfo.recvEmployeeId;
            pWeekSum.IsNew          = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pWeekSum.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(WeekSumInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pWeekSumInfo.weekSumId = pWeekSum.WeekSumId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(WeekSumInfo)))
            {
                ResetCache();
            }
        }
예제 #3
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 <WeekSumInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <WeekSumInfo> list = new List <WeekSumInfo>();

            Query q = WeekSum.CreateQuery();

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

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (WeekSum weekSum  in collection)
            {
                WeekSumInfo weekSumInfo = new WeekSumInfo();
                LoadFromDAL(weekSumInfo, weekSum);
                list.Add(weekSumInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
예제 #4
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <WeekSumInfo> pList, WeekSumCollection pCollection)
 {
     foreach (WeekSum weekSum in pCollection)
     {
         WeekSumInfo weekSumInfo = new WeekSumInfo();
         LoadFromDAL(weekSumInfo, weekSum);
         pList.Add(weekSumInfo);
     }
 }
예제 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int wksumid = Convert.ToInt32(Request["WeekSumId"].ToString());
         WeekSumInfo sum = new WeekSumInfo(wksumid);
         txtSumName.Text = sum.WeekSumName.ToString();
         gvDataBind();
     }
 }
예제 #6
0
 //从后台获取数据
 internal static void  LoadFromDAL(WeekSumInfo pWeekSumInfo, WeekSum pWeekSum)
 {
     pWeekSumInfo.weekSumId      = pWeekSum.WeekSumId;
     pWeekSumInfo.weekSumName    = pWeekSum.WeekSumName;
     pWeekSumInfo.isApprove      = pWeekSum.IsApprove;
     pWeekSumInfo.isApply        = pWeekSum.IsApply;
     pWeekSumInfo.isSend         = pWeekSum.IsSend;
     pWeekSumInfo.applyTime      = pWeekSum.ApplyTime;
     pWeekSumInfo.repplyTime     = pWeekSum.RepplyTime;
     pWeekSumInfo.applyView      = pWeekSum.ApplyView;
     pWeekSumInfo.sendEmployeeId = pWeekSum.SendEmployeeId;
     pWeekSumInfo.recvEmployeeId = pWeekSum.RecvEmployeeId;
     pWeekSumInfo.Loaded         = true;
 }
예제 #7
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(WeekSumInfo pWeekSumInfoFrom, WeekSumInfo pWeekSumInfoTo)
 {
     pWeekSumInfoTo.WeekSumId      = pWeekSumInfoFrom.weekSumId;
     pWeekSumInfoTo.WeekSumName    = pWeekSumInfoFrom.weekSumName;
     pWeekSumInfoTo.IsApprove      = pWeekSumInfoFrom.isApprove;
     pWeekSumInfoTo.IsApply        = pWeekSumInfoFrom.isApply;
     pWeekSumInfoTo.IsSend         = pWeekSumInfoFrom.isSend;
     pWeekSumInfoTo.ApplyTime      = pWeekSumInfoFrom.applyTime;
     pWeekSumInfoTo.RepplyTime     = pWeekSumInfoFrom.repplyTime;
     pWeekSumInfoTo.ApplyView      = pWeekSumInfoFrom.applyView;
     pWeekSumInfoTo.SendEmployeeId = pWeekSumInfoFrom.sendEmployeeId;
     pWeekSumInfoTo.RecvEmployeeId = pWeekSumInfoFrom.recvEmployeeId;
     pWeekSumInfoTo.Loaded         = pWeekSumInfoFrom.Loaded;
 }
예제 #8
0
 protected void gvwWeekSum_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     int wksumid = Convert.ToInt32(gvwWeekSum.DataKeys[e.RowIndex].Value);
     try
     {
         WeekSumInfo wksum = new WeekSumInfo(wksumid);
         wksum.RecvEmployeeId = -1;
         gvDataBind();
     }
     catch(Exception Ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('ɾ��ʧ�ܣ�" + Ex.Message + "');", true);
     }
 }
예제 #9
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     DateTime date = DateTime.Now;
     int departid = Convert.ToInt32(Session["DepartId"]);
     int recvEmployeeId = Convert.ToInt32(DayInfo.getRecvEmployeeId(departid));
     int wksumId = Convert.ToInt32(((Button)sender).CommandArgument.ToString());
     WeekSumInfo wksum = new WeekSumInfo(wksumId);
     wksum.IsApply = 0;
     wksum.IsSend = 1;
     wksum.ApplyTime = date;
     wksum.RecvEmployeeId = recvEmployeeId;
     wksum.Save();
     gvwBind();
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ͳɹ���');</script>");
 }
예제 #10
0
        public WeekSumInfo GetWeekSumInfoById(int WeekSumId)
        {
            WeekSumInfo weekSumInfo  = null;//
            try
            {
                 weekSumInfo = new WeekSumInfo(WeekSumId);

            }
            catch (AppException)
            {
                return null;
            }

            return  weekSumInfo;
        }
예제 #11
0
        public WeekSumInfo GetWeekSumInfoById(int WeekSumId)
        {
            WeekSumInfo weekSumInfo = null;             //

            try
            {
                weekSumInfo = new WeekSumInfo(WeekSumId);
            }
            catch (AppException)
            {
                return(null);
            }

            return(weekSumInfo);
        }
예제 #12
0
        protected void btnSaveWkSum_Click(object sender, EventArgs e)
        {
            int wksumid = Convert.ToInt32(Request["WeekSumId"].ToString());
            if (gvwDay.Rows.Count == 0)
            {
                DayInfo.DelWeekSum(wksumid);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ܽ�Ϊ�գ���ɾ����');</script>");
            }
            else
            {

                WeekSumInfo wksum = new WeekSumInfo(wksumid);
                wksum.WeekSumName = txtSumName.Text.ToString();
                wksum.Save();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�༭�ɹ���');</script>");

            }
            Response.Redirect("WeekApply.aspx");
        }
예제 #13
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     int wksumid = Convert.ToInt32(Request["WeekSumId"].ToString());
     WeekSumInfo wksum = new WeekSumInfo(wksumid);
     DateTime time = DateTime.Now;
     wksum.IsApply = 1;
     wksum.RepplyTime = time;
     wksum.ApplyView = txtView.Text.ToString();
     if (rblApprove.Items[0].Selected)
     {
         wksum.IsApprove = 0;
     }
     else if (rblApprove.Items[1].Selected)
     {
         wksum.IsApprove = 1;
     }
     wksum.Save();
     Response.Redirect("WeekApprove.aspx");
 }
예제 #14
0
 private void LoadFromId(int weekSumId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(WeekSumInfo)))
     {
         WeekSumInfo weekSumInfo = Find(GetList(), weekSumId);
         if (weekSumInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(weekSumInfo, this);
     }
     else
     {
         WeekSum weekSum = new WeekSum(weekSumId);
         if (weekSum.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, weekSum);
     }
 }
예제 #15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int wksumid = Convert.ToInt32(Request["sumId"].ToString());
            if (gvwDay.Rows.Count == 0)
            {
                DayInfo.DelWeekSum(wksumid);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�������־');</script>");
            }
            else
            {
                int emid = Convert.ToInt32(Session["EmployeeId"]);
                WeekSumInfo wksum = new WeekSumInfo(wksumid);
                wksum.WeekSumName = txtSumName.Text.ToString();
                wksum.SendEmployeeId = emid;
                wksum.IsSend = 0;
                wksum.IsApply = 0;
                wksum.IsApprove = 0;
                wksum.Save();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('��ӳɹ�');</script>");

            }
            Response.Redirect("WeekApply.aspx");
        }
예제 #16
0
 public List <WeekSumInfo> GetWeekSumInfoList()
 {
     return(WeekSumInfo.GetList());
 }
예제 #17
0
 public object SaveWeekSumInfo(WeekSumInfo weekSumInfo)
 {
     weekSumInfo.Save();
     return weekSumInfo . WeekSumId;
 }
예제 #18
0
 public List <WeekSumInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(WeekSumInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
예제 #19
0
 public void DeleteById(WeekSumInfo pWeekSumInfo)
 {
     WeekSumInfo weekSumInfo = new WeekSumInfo(pWeekSumInfo.WeekSumId);
     weekSumInfo.Delete();
 }
예제 #20
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(WeekSumInfo pWeekSumInfoTo)
 {
     Copy(this, pWeekSumInfoTo);
 }
예제 #21
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< WeekSumInfo> pList, WeekSumCollection pCollection)
 {
     foreach (WeekSum weekSum in pCollection)
     {
         WeekSumInfo weekSumInfo = new WeekSumInfo();
         LoadFromDAL(weekSumInfo, weekSum );
         pList.Add(weekSumInfo);
     }
 }
예제 #22
0
 protected void btnAddWeek_Click(object sender, EventArgs e)
 {
     WeekSumInfo wksum = new WeekSumInfo();
     wksum.Save();
     Response.Redirect("AddWeek.aspx?sumId="+wksum.WeekSumId);
 }
예제 #23
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(WeekSumInfo pWeekSumInfoFrom, WeekSumInfo pWeekSumInfoTo)
 {
     pWeekSumInfoTo.WeekSumId = pWeekSumInfoFrom.weekSumId;
      		pWeekSumInfoTo.WeekSumName = pWeekSumInfoFrom.weekSumName;
      		pWeekSumInfoTo.IsApprove = pWeekSumInfoFrom.isApprove;
      		pWeekSumInfoTo.IsApply = pWeekSumInfoFrom.isApply;
      		pWeekSumInfoTo.IsSend = pWeekSumInfoFrom.isSend;
      		pWeekSumInfoTo.ApplyTime = pWeekSumInfoFrom.applyTime;
      		pWeekSumInfoTo.RepplyTime = pWeekSumInfoFrom.repplyTime;
      		pWeekSumInfoTo.ApplyView = pWeekSumInfoFrom.applyView;
      		pWeekSumInfoTo.SendEmployeeId = pWeekSumInfoFrom.sendEmployeeId;
      		pWeekSumInfoTo.RecvEmployeeId = pWeekSumInfoFrom.recvEmployeeId;
     pWeekSumInfoTo.Loaded=pWeekSumInfoFrom.Loaded;
 }
예제 #24
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<WeekSumInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(WeekSumInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< WeekSumInfo>;
     }
     else
     {
         List< WeekSumInfo>  list =new List< WeekSumInfo>();
         WeekSumCollection  collection=new  WeekSumCollection();
         Query qry = new Query(WeekSum.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(WeekSum weekSum in collection)
         {
             WeekSumInfo weekSumInfo= new WeekSumInfo();
             LoadFromDAL(weekSumInfo,weekSum);
             list.Add(weekSumInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(WeekSumInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
예제 #25
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<WeekSumInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< WeekSumInfo> list = new List< WeekSumInfo>();

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

            foreach (WeekSum  weekSum  in collection)
            {
                WeekSumInfo weekSumInfo = new WeekSumInfo();
                LoadFromDAL(weekSumInfo,   weekSum);
                list.Add(weekSumInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
예제 #26
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(WeekSumInfo pWeekSumInfoTo)
 {
     Copy(this,  pWeekSumInfoTo);
 }
예제 #27
0
        public void DeleteById(WeekSumInfo pWeekSumInfo)
        {
            WeekSumInfo weekSumInfo = new WeekSumInfo(pWeekSumInfo.WeekSumId);

            weekSumInfo.Delete();
        }
예제 #28
0
 //数据持久化
 internal static void SaveToDb(WeekSumInfo pWeekSumInfo, WeekSum  pWeekSum,bool pIsNew)
 {
     pWeekSum.WeekSumId = pWeekSumInfo.weekSumId;
      		pWeekSum.WeekSumName = pWeekSumInfo.weekSumName;
      		pWeekSum.IsApprove = pWeekSumInfo.isApprove;
      		pWeekSum.IsApply = pWeekSumInfo.isApply;
      		pWeekSum.IsSend = pWeekSumInfo.isSend;
      		pWeekSum.ApplyTime = pWeekSumInfo.applyTime;
      		pWeekSum.RepplyTime = pWeekSumInfo.repplyTime;
      		pWeekSum.ApplyView = pWeekSumInfo.applyView;
      		pWeekSum.SendEmployeeId = pWeekSumInfo.sendEmployeeId;
      		pWeekSum.RecvEmployeeId = pWeekSumInfo.recvEmployeeId;
     pWeekSum.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pWeekSum.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(WeekSumInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pWeekSumInfo.weekSumId = pWeekSum.WeekSumId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(WeekSumInfo)))
     {
         ResetCache();
     }
 }
예제 #29
0
 public object  SaveWeekSumInfo(WeekSumInfo weekSumInfo)
 {
     weekSumInfo.Save();
     return(weekSumInfo.WeekSumId);
 }
예제 #30
0
 //从后台获取数据
 internal static void LoadFromDAL(WeekSumInfo pWeekSumInfo, WeekSum  pWeekSum)
 {
     pWeekSumInfo.weekSumId = pWeekSum.WeekSumId;
      		pWeekSumInfo.weekSumName = pWeekSum.WeekSumName;
      		pWeekSumInfo.isApprove = pWeekSum.IsApprove;
      		pWeekSumInfo.isApply = pWeekSum.IsApply;
      		pWeekSumInfo.isSend = pWeekSum.IsSend;
      		pWeekSumInfo.applyTime = pWeekSum.ApplyTime;
      		pWeekSumInfo.repplyTime = pWeekSum.RepplyTime;
      		pWeekSumInfo.applyView = pWeekSum.ApplyView;
      		pWeekSumInfo.sendEmployeeId = pWeekSum.SendEmployeeId;
      		pWeekSumInfo.recvEmployeeId = pWeekSum.RecvEmployeeId;
     pWeekSumInfo.Loaded=true;
 }