//签到操作 public JsonResult AttendOn(int id, string code = "") { string ip = GetIP(); DateTime AttentTime = DateTime.Now; int userid = CurrentUser.Id; string usercode = CurrentUser.Code; string realname = CurrentUser.Realname; if (code != "") { IList <UserType> users = NSession.CreateQuery("from UserType where Code='" + code + "'").List <UserType>(); if (users.Count > 0) { userid = users[0].Id; usercode = users[0].Code; realname = users[0].Realname; } else { return(Json(new { Msg = code + " 编号不存在!" }, JsonRequestBehavior.AllowGet)); } } AttendType obj = new AttendType() { CurrentDate = AttentTime.Date, UserId = userid, UserCode = usercode, RealName = realname }; try { IList <AttendType> list = NSession.CreateQuery("from AttendType where UserId='" + obj.UserId + "' and CurrentDate='" + obj.CurrentDate + "'").List <AttendType>(); if (IsOK(ip)) { //IList<AttendType> objList = NSession.CreateQuery("from AttendType " + " where UserId=\'" + obj.UserId + "\' order by CurrentDate desc ") //.List<AttendType>(); //if (objList.Count > 0) //{ // //NoAttend(objList[0].CurrentDate); //} if (list.Count > 0) { obj = list[0]; } obj.IP = ip; } else { return(Json(new { Msg = "请使用公司网络打卡!" }, JsonRequestBehavior.AllowGet)); } switch (id) { case 0: if (string.IsNullOrEmpty(obj.AMStart)) { obj.AMStart = AttentTime.ToString("yyyy-MM-dd HH:mm:ss"); } else { return(Json(new { Msg = "请不要重复打卡!" }, JsonRequestBehavior.AllowGet)); } break; case 1: if (string.IsNullOrEmpty(obj.AMEnd)) { obj.AMEnd = AttentTime.ToString("yyyy-MM-dd HH:mm:ss"); } else { return(Json(new { Msg = "请不要重复打卡!" }, JsonRequestBehavior.AllowGet)); } break; case 2: if (string.IsNullOrEmpty(obj.PMStart)) { obj.PMStart = AttentTime.ToString("yyyy-MM-dd HH:mm:ss"); } else { return(Json(new { Msg = "请不要重复打卡!" }, JsonRequestBehavior.AllowGet)); } break; case 3: if (string.IsNullOrEmpty(obj.PMEnd)) { obj.PMEnd = AttentTime.ToString("yyyy-MM-dd HH:mm:ss"); } else { return(Json(new { Msg = "请不要重复打卡!" }, JsonRequestBehavior.AllowGet)); } break; } NSession.SaveOrUpdate(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { Msg = "出错了" }, JsonRequestBehavior.AllowGet)); } return(Json(new { Msg = obj.RealName + " 签到成功:" + AttentTime.ToString("yyyy-MM-dd HH:mm:ss") }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetRecord(int id) { IList <DisputesRecordType> list = NSession.CreateQuery("from DisputesRecordType where DId='" + id + "'").List <DisputesRecordType>(); return(Json(new { rows = list })); }
public JsonResult SearchOrder(string id) { IList <OrderType> obj = NSession.CreateQuery("from OrderType where OrderNo=:OrderNo or OrderExNo=:OrderNo").SetString("OrderNo", id).List <OrderType>(); return(Json(obj, JsonRequestBehavior.AllowGet)); }
public JsonResult SearchOrderP(string id) { IList <OrderProductType> obj = NSession.CreateQuery("from OrderProductType where OId=:oid").SetString("oid", id).List <OrderProductType>(); return(Json(obj, JsonRequestBehavior.AllowGet)); }
public JsonResult QList() { IList <object[]> objList = NSession.CreateQuery("select Id,TempName from PrintTemplateType").List <object[]>(); return(Json(objList)); }