Example #1
0
        public bool InsertSum(SumBaseDto summary)
        {
            try
            {
                Summary list    = AutoMapperHelp.ConvertModel <Summary, SumBaseDto>(summary);
                var     date    = DateTime.Now;
                int     dayweek = (int)date.DayOfWeek;
                if (dayweek == 0)
                {
                    dayweek = 7;
                }
                DateTime startTime = date.AddDays(-(dayweek));
                DateTime endTime   = date.AddDays(7 - dayweek);

                DateTime time = date;

                list.User_ID    = Convert.ToInt32(LoginBase.ID);
                list.Time       = time;
                list.Start_Time = startTime;
                list.End_Time   = endTime;
                Summary sumDt = SumRepository.Add(list);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #2
0
        public bool InsertInfo(RegisterDto UserInfo)
        {
            try
            {
                User uList = AutoMapperHelp.ConvertModel <User, RegisterDto>(UserInfo);
                //var roomList = room.Query().Where(m=>m.Name == UserInfo.Room_Name);
                uList.Room_ID = UserInfo.Room_ID;
                uList.Image   = "../../images/user.jpg";
                uList.Motto   = null;
                if (UserInfo.U_Role == 2)
                {
                    uList.IsExamine = true;
                }
                else
                {
                    uList.IsExamine = false;
                }
                uList.IP            = null;
                uList.Register_Time = DateTime.Now;
                User insertList = Information.Add(uList);
                //int insertCount = insertList.Equipment.Count();
                //return insertCount;

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #3
0
 /// <summary>
 /// 数据插入
 /// </summary>
 /// <param name="Leaveinfo"></param>
 /// <returns></returns>
 public bool InsertInfo(EquipBaseDto Leaveinfo)
 {
     try
     {
         Equipment uList      = AutoMapperHelp.ConvertModel <Equipment, EquipBaseDto>(Leaveinfo);
         Equipment insertList = EquipRepository.Add(uList);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #4
0
 public bool InsertInfo(LeaveBaseDto Leaveinfo)
 {
     try
     {
         Leave uList      = AutoMapperHelp.ConvertModel <Leave, LeaveBaseDto>(Leaveinfo);
         Leave insertList = LeaveRepository.Add(uList);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        //public List<DutyNeedDto> GetDutyData()
        //{
        //    DutyNeedDto DutyNeedData = new DutyNeedDto();
        //    List<DutyDto> DutyList = GetDuty();
        //    int userId = DutyList[0].User_ID;
        //    List<UserDto> UserList = UserData.GetUser(userId);
        //    DutyNeedData.Real_Name = UserList[0].Real_Name;
        //    DutyNeedData.DutyStart = DutyList[0].DutyStart;
        //    DutyNeedData.DutyEnd = DutyList[0].DutyEnd;
        //    //DutyNeedData.Url = DutyList[0].Url;
        //    List<DutyNeedDto> returnList = new List<DutyNeedDto>();
        //    returnList.Add(DutyNeedData);
        //    return returnList;
        //}
        public bool InsertDtoData(DateTime DutyStart, DateTime DutyEnd, int User_ID)
        {
            Duty oDuty = new Duty();

            oDuty.DutyStart = DutyStart;
            oDuty.DutyEnd   = DutyEnd;
            oDuty.User_ID   = User_ID;
            //var list = LabRepository.Query().Where(c => c.Enabled == 1);
            //List<Notice> NoticeList = list.ToList().ConvertAll(c => AutoMapperHelp.ConvertToDto<Notice, Notice>(c));
            //NoticeList[0].Enabled = 0;
            //LabRepository.Update(NoticeList[0]);
            LabRepository.Add(oDuty);
            return(true);
        }
Example #6
0
        public bool InsertNoticeData(string oNoticeTitle, string oNoticeText, DateTime oNowTime, int UserId)
        {
            Notice aTable = new Notice();

            aTable.Enabled = 1;
            aTable.Text    = oNoticeText;
            aTable.Title   = oNoticeTitle;
            aTable.Time    = oNowTime;
            aTable.User_ID = UserId;

            var           list       = LabRepository.Query().Where(c => c.Enabled == 1);
            List <Notice> NoticeList = list.ToList().ConvertAll(c => AutoMapperHelp.ConvertToDto <Notice, Notice>(c));

            if (NoticeList.Count != 0)
            {
                NoticeList[0].Enabled = 0;
                LabRepository.Update(NoticeList[0]);
            }
            LabRepository.Add(aTable);
            return(true);
        }
        public bool userSign(int UID, string ip)
        {
            //string Uip = (HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null) ? HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString() : HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();//修改IP信息
            string UIP = "";

            if (UIP != ip)
            {
                return(false);
            }
            DateTime   time = DateTime.Now;
            Attendance att  = new Attendance();

            att.Time    = time;
            att.User_ID = UID;
            att.Type    = 1;
            att.Shift   = time_Shift(time.ToString());
            if (att.Shift < 10 && att.Shift != 4)
            {
                att.State = 1;
            }
            else if (att.Shift > 10)
            {
                att.State = 2;
                att.Shift = att.Shift - 10;
            }
            string               dateday     = time.ToString("yyyy-MM-dd");
            DateTime             flagday     = Convert.ToDateTime(dateday);
            DateTime             flagday_end = flagday.AddDays(1);
            var                  list        = tableAttendance.Query().Where(c => (c.Time >= flagday) && (c.Time <= flagday_end) && (c.Type == att.Type) && (c.User_ID == att.User_ID) && (c.Shift == att.Shift));
            List <AttendanceDto> qqList      = list.ToList().ConvertAll(c => AutoMapperHelp.ConvertToDto <Attendance, AttendanceDto>(c));
            int                  count       = qqList.Count();

            if (count <= 0)
            {
                tableAttendance.Add(att);
            }
            return(true);
        }