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); } }
public List <Sign_dateModel> Get_data(int UID, int type) { var list = tableAttendance.Query().Where(c => c.User_ID == UID && c.Type == type); //? List <AttendanceDto> qqList = list.ToList().ConvertAll(c => AutoMapperHelp.ConvertToDto <Attendance, AttendanceDto>(c)); AttendanceDto tt = qqList.FirstOrDefault(); Attendance ss = AutoMapperHelp.ConvertModel <Attendance, AttendanceDto>(tt); int count = qqList.Count(); List <Sign_dateModel> Sign_dataList = new List <Sign_dateModel>(); for (int i = 0; i < count; i++) { string face = "( ^ _ ^ )"; Sign_dateModel Sign_data = new Sign_dateModel(); if (qqList[i].State == 1)//签到状态 正常 { Sign_data.color = "green"; } else if (qqList[i].State == 2)//签到状态迟到 { Sign_data.color = "bleak"; face = "(っ°Д°;)っ"; } else if (qqList[i].State == 3)//签到状态请假 { Sign_data.color = "red"; face = "( > _ < )"; } Sign_data.id = qqList[i].Shift; //签到次序 Sign_data.start = qqList[i].Time.ToString("yyyy-MM-dd HH:mm:ss"); //签到时间 Sign_data.end = qqList[i].Time.ToString("yyyy-MM-dd"); if (qqList[i].Shift == 1) { Sign_data.title = face + "早"; //Sign_data.start += " 08:30:00"; //Sign_data.end += " 11:30:00"; } else if (qqList[i].Shift == 2) { Sign_data.title = face + "中";//( > _ < ) //Sign_data.start += " 14:30:00"; //Sign_data.end += " 17:30:00"; } else if (qqList[i].Shift == 3) { //∑(っ °Д °;)っ Sign_data.title = face + "晚"; //Sign_data.start += " 19:00:00"; //Sign_data.end += " 20:30:00"; } Sign_dataList.Add(Sign_data); } return(Sign_dataList); }
public void Ecxel_add(string time, int uid) { Attendance att = new Attendance(); att.Shift = time_Shift(time); att.User_ID = uid; att.Type = 2; if (att.Shift < 10 && att.Shift != 4) { att.State = 1; } else if (att.Shift > 10) { att.State = 2; att.Shift = att.Shift - 10; } att.Time = Convert.ToDateTime(time); var list = tableAttendance.Query().Where(c => (c.Time >= att.Time) && (c.Type == att.Type) && (c.User_ID == uid)); List <AttendanceDto> qqList = list.ToList().ConvertAll(c => AutoMapperHelp.ConvertToDto <Attendance, AttendanceDto>(c)); AttendanceDto tt = qqList.FirstOrDefault(); Attendance ss = AutoMapperHelp.ConvertModel <Attendance, AttendanceDto>(tt); int count = qqList.Count(); if (count <= 0) { tableAttendance.Add(att); } }
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); } }
public List <UserBaseDto> GetAll(int ID) { var list = userRepository.Query().Where(m => m.ID == ID); List <UserBaseDto> userList = list.ToList().ConvertAll(c => AutoMapperHelp.ConvertToDto <User, UserBaseDto>(c)); UserBaseDto tt = userList.FirstOrDefault(); User ss = AutoMapperHelp.ConvertModel <User, UserBaseDto>(tt); int count = list.Count(); return(userList); }
/// <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); } }
public bool InsertInfo(LeaveBaseDto Leaveinfo) { try { Leave uList = AutoMapperHelp.ConvertModel <Leave, LeaveBaseDto>(Leaveinfo); Leave insertList = LeaveRepository.Add(uList); return(true); } catch { return(false); } }