Ejemplo n.º 1
0
 /// <summary>
 /// 编辑请假申请
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public LeaveInfo EditLeaveInfo(LeaveInfoEditRequest info)
 {
     using (var db = new DefaultContainer()) {
         var row = db.Db_BaseWorkOrderSet.OfType <Db_OA_Leave>().Single(p => p.Id == this.Id);
         row.BeginTime = info.BeginTime;
         row.EndTime   = info.EndTime;
         row.LeaveType = (byte)info.Type.GetHashCode();
         row.Descript  = info.Descript;
         db.SaveChanges();
         return(new LeaveInfo(row));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建请假申请
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static LeaveInfo CreateLeaveInfo(LeaveInfoEditRequest info)
        {
            string remarkString = string.Format("请假,从{0}至{1},{2},申请人:{3}", info.BeginTime.ToString("yyyy-MM-dd HH:mm"), info.EndTime.ToString("yyyy-MM-dd HH:mm"), info.Type.ToString(), info.User.getFullNameString());

            using (var db = new DefaultContainer()) {
                Db_OA_Leave dbl = new Db_OA_Leave()
                {
                    BeginTime = info.BeginTime,
                    EndTime   = info.EndTime,
                    CreatedOn = DateTime.Now,
                    Descript  = info.Descript,
                    Id        = Guid.NewGuid().ToString(),
                    LeaveType = (byte)info.Type,
                    OrderType = (byte)WorkOrderType.请假申请.GetHashCode(),
                    Remark    = remarkString,
                    UserId    = info.User.getIdString(),
                };
                db.Db_BaseWorkOrderSet.Add(dbl);
                db.SaveChanges();
                return(new LeaveInfo(dbl));
            }
        }