/// <summary> /// 根据guid获取人员相关信息 /// </summary> /// <param name="vguid"></param> /// <returns></returns> public Business_Personnel_Information GetPersonInfo(Guid vguid) { using (var db = SugarDao_MsSql.GetInstance()) { return(db.Queryable <Business_Personnel_Information>().Where(i => i.Vguid == vguid).SingleOrDefault()); } }
/// <summary> /// 删除未提交问卷 /// </summary> /// <param name="vguid">问卷Vguid</param> /// <returns></returns> public bool DeletedQuestion(string vguid) { using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance()) { bool result = false; Guid questionVguid = Guid.Parse(vguid); try { _dbMsSql.BeginTran(); Business_Questionnaire exerciseModel = _dbMsSql.Queryable <Business_Questionnaire>().Where(i => i.Vguid == questionVguid).SingleOrDefault(); string logData = JsonHelper.ModelToJson(exerciseModel); result = _dbMsSql.Delete <Business_Questionnaire>(i => i.Vguid == questionVguid); //删除问卷主表 if (result) { List <Business_QuestionnaireDetail> exercisesDetail = _dbMsSql.Queryable <Business_QuestionnaireDetail>().Where(i => i.QuestionnaireVguid == questionVguid).ToList(); if (exercisesDetail.Count != 0) { result = _dbMsSql.Delete <Business_QuestionnaireDetail>(i => i.QuestionnaireVguid == questionVguid); //删除问卷附表 } } _ll.SaveLog(2, 52, Common.CurrentUser.GetCurrentUser().LoginName, exerciseModel.QuestionnaireName, logData); _dbMsSql.CommitTran(); } catch (Exception exp) { _dbMsSql.RollbackTran(); Common.LogHelper.LogHelper.WriteLog(exp.ToString()); _ll.SaveLog(5, 52, Common.CurrentUser.GetCurrentUser().LoginName, "", exp.ToString()); } return(result); } }
/// <summary> /// 获取草稿知识库的列表信息 /// </summary> /// <param name="searchParam">搜索条件</param> /// <param name="para">分页信息</param> /// <returns></returns> public JsonResultModel <V_Business_KnowledgeBase_Information> GetKnowledgeListBySearch(Business_KnowledgeBase_Information searchParam, GridParams para) { using (var db = SugarDao_MsSql.GetInstance()) { JsonResultModel <V_Business_KnowledgeBase_Information> jsonResult = new JsonResultModel <V_Business_KnowledgeBase_Information>(); var query = db.Queryable <V_Business_KnowledgeBase_Information>().Where(i => i.Status == "1"); if (!string.IsNullOrEmpty(searchParam.Title)) { query.Where(i => i.Title.Contains(searchParam.Title)); } if (!string.IsNullOrEmpty(searchParam.Remark)) { query.Where(i => i.Remark.Contains(searchParam.Remark)); } if (!string.IsNullOrEmpty(searchParam.Type)) { query.Where(i => i.Type.Contains(searchParam.Type)); } if (searchParam.CreatedDate != DateTime.MinValue) { query.Where(i => i.CreatedDate >= searchParam.CreatedDate); } query.OrderBy(para.sortdatafield + " " + para.sortorder); jsonResult.TotalRows = query.Count(); jsonResult.Rows = query.ToPageList(para.pagenum, para.pagesize); //存入操作日志表 string logData = JsonHelper.ModelToJson(jsonResult); _ll.SaveLog(3, 40, CurrentUser.GetCurrentUser().LoginName, "草稿列表", logData); return(jsonResult); } }
/// <summary> /// 判断登录的用户名和密码是否正确 /// </summary> /// <param name="loginName">用户名</param> /// <param name="pwd">密码</param> /// <returns></returns> public string ProcessLogin(string loginName, string pwd) { using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance()) { bool userResult = _dbMsSql.Queryable <Sys_User>().Any(i => i.LoginName == loginName); if (!userResult) { return("用户名错误!"); } else { bool enableUser = _dbMsSql.Queryable <Sys_User>().Any(i => i.Enable == "1"); if (!enableUser) { return("用户已被禁用!"); } bool pwdResult = _dbMsSql.Queryable <Sys_User>().Any(i => i.LoginName == loginName && i.Password == pwd); if (!pwdResult) { return("用户密码错误!"); } } } //存入操作日志表 //_ll.SaveLog(14, 0, "", loginName); return("登陆成功!"); }
/// <summary> /// API权限是否开启 /// </summary> /// <returns></returns> public bool findAPIConfig() { using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance()) { return(_dbMsSql.Queryable <Master_Configuration>().Any(i => i.ID == 17 && i.ConfigValue == "1")); } }
public void UpdateHomecomingSurvey(Business_HomecomingSurvey hs) { using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance()) { _dbMsSql.Update <Business_HomecomingSurvey>( new { LicensePlate = hs.LicensePlate, WhetherReturnHome = hs.WhetherReturnHome, StartDate = hs.StartDate, EndDate = hs.EndDate, ChangeDate = hs.ChangeDate, ChangeUser = hs.CreatedUser, CheckDrivingG = hs.CheckDrivingG, CheckDrivingB = hs.CheckDrivingB, BackCarNo = hs.BackCarNo, BackAdress = hs.BackAdress, GoCarNo = hs.GoCarNo, OrganizationName = hs.OrganizationName, Fleet = hs.Fleet, CheckDrivingGR = hs.CheckDrivingGR, CheckDrivingBR = hs.CheckDrivingBR }, c => c.Vguid == hs.Vguid); } }
/// <summary> /// 批量删除推送信息 /// </summary> /// <param name="vguid"></param> /// <returns></returns> public bool DeletePushHistory(string vguid) { using (var db = SugarDao_MsSql.GetInstance()) { db.BeginTran(); try { Guid guid = Guid.Parse(vguid); Business_WeChatPush_Information weChatPushInfo = db.Queryable <Business_WeChatPush_Information>().Where(i => i.VGUID == guid).SingleOrDefault(); string weChatJson = JsonHelper.ModelToJson(weChatPushInfo); _ll.SaveLog(2, 37, CurrentUser.GetCurrentUser().LoginName, weChatPushInfo.Title, weChatJson); //存入操作日志表 db.Update <Business_WeChatPush_Information>(new { History = 0 }, c => c.VGUID == guid); //假删除 db.CommitTran(); return(true); } catch (Exception ex) { Common.LogHelper.LogHelper.WriteLog(ex.Message + "/n" + ex + "/n" + ex.StackTrace); _ll.SaveLog(5, 37, CurrentUser.GetCurrentUser().LoginName, "删除推送历史信息", vguid); db.RollbackTran(); return(false); } } }
/// <summary> /// 给阅读消息历史并且没有答过题的人重新推送习题 /// </summary> /// <param name="businessPersonnelVguid"></param> /// <param name="wechatMainVguid"></param> /// <returns></returns> public bool ReWechatPushExercise(string businessPersonnelVguid, string wechatMainVguid) { Guid mainVguid = Guid.Parse(wechatMainVguid); Guid personnelVguid = Guid.Parse(businessPersonnelVguid); bool result = false; using (SqlSugarClient db = SugarDao_MsSql.GetInstance()) { try { db.BeginTran(); var wechatMainModel = db.Queryable <Business_WeChatPush_Information>().Where(i => i.VGUID == mainVguid).SingleOrDefault(); var currentUser = db.Queryable <Business_Personnel_Information>().Where(i => i.Vguid == personnelVguid).Select(i => i.UserID).SingleOrDefault(); DateTime?dateTime = null; var wechatMain = new Business_WeChatPush_Information() { PushType = 1, Title = wechatMainModel.Title, MessageType = 4, Timed = false, TimedSendTime = null, Important = wechatMainModel.PeriodOfValidity == null, PeriodOfValidity = wechatMainModel.PeriodOfValidity == null ? dateTime : DateTime.Now.AddMonths(1), Message = "从消息历史获取", PushPeople = wechatMainModel.PushPeople, Status = 3, CreatedDate = DateTime.Now, CreatedUser = wechatMainModel.CreatedUser, VGUID = Guid.NewGuid(), CoverImg = wechatMainModel.CoverImg, CoverDescption = wechatMainModel.CoverDescption, ExercisesVGUID = wechatMainModel.ExercisesVGUID, History = "0", Department_VGUID = Guid.Empty }; var wechatDetail = new Business_WeChatPushDetail_Information() { Type = "1", PushObject = currentUser, CreatedUser = wechatMainModel.CreatedUser, CreatedDate = DateTime.Now, Vguid = Guid.NewGuid(), Business_WeChatPushVguid = wechatMain.VGUID, ISRead = "0", }; string logdata = Extend.ModelToJson(wechatMain); _ll.SaveLog(10, 34, currentUser, "从消息历史获取习题", logdata); db.Insert(wechatDetail, false); db.Insert(wechatMain, false); db.CommitTran(); result = true; } catch (Exception ex) { db.RollbackTran(); LogHelper.WriteLog(ex.ToString()); } } return(result); }
public JsonResult GetAccidentInfo(string fleet, string date, string carID, string code) { var cm = CacheManager <Personnel_Info> .GetInstance()[PubGet.GetUserKey + code]; var ownedCompany = cm.Organization; var fleetAll = PartnerHomePageController.getSqlInValue(cm.MotorcadeName, code); //ownedCompany = "第一服务中心"; var date1 = date.TryToDate(); var date2 = date1.AddDays(1).ToString("yyyy-MM-dd"); //var date1 = "2020-04-24"; //var date2 = "2020-06-14"; List <Accident_cabInfo> visionetList = new List <Accident_cabInfo>(); using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance2()) { if (fleet == "0") { fleet = fleetAll; } else { fleet = "'" + fleet + "'"; } visionetList = getVisionetList(_dbMsSql, date, fleet, ownedCompany, date1, date2, cm.DepartmenManager); if (carID != null && carID != "") { visionetList = visionetList.Where(x => x.carNo.Contains(carID)).ToList(); } } return(Json(visionetList, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 审核推送信息 /// </summary> /// <param name="vguid"></param> /// <returns></returns> public bool CheckSubmitList(string vguid) { using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance()) { bool result = false; Guid Vguid = Guid.Parse(vguid); try { _dbMsSql.BeginTran(); result = _dbMsSql.Update <Business_WeChatPush_Information>(new { Status = 3 }, i => i.VGUID == Vguid); Business_WeChatPush_Information weChatPushModel = _dbMsSql.Queryable <Business_WeChatPush_Information>().Where(i => i.VGUID == Vguid).SingleOrDefault(); string jsonResult = JsonHelper.ModelToJson <Business_WeChatPush_Information>(weChatPushModel); //存入操作日志表 _ll.SaveLog(9, 16, Common.CurrentUser.GetCurrentUser().LoginName, weChatPushModel.Title, jsonResult); _dbMsSql.CommitTran(); } catch (Exception ex) { _dbMsSql.RollbackTran(); Common.LogHelper.LogHelper.WriteLog(ex.Message + "/n" + ex.ToString() + "/n" + ex.StackTrace); } finally { } return(result); } }
/// <summary> /// 通过习题主信息Vguid和人员Vguid获取全套习题信息 /// </summary> /// <param name="Vguid"></param> /// <param name="personVguid"></param> /// <returns></returns> public JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information> GetExerciseDoneAllMsg(string vguid, string personVguid) { using (SqlSugarClient dbMsSql = SugarDao_MsSql.GetInstance()) { Guid Vguid = Guid.Parse(vguid); Guid personalVguid = Guid.Parse(personVguid); JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information> exerciseAll = new JsonResultEntity <V_Business_ExercisesAndAnswer_Infomation, V_Business_ExercisesDetailAndExercisesAnswerDetail_Information>(); string sql = string.Format("exec usp_UserExercisesInformation '{0}','{1}'", personalVguid, Vguid); var query1 = dbMsSql.Queryable <V_Business_ExercisesAndAnswer_Infomation>(); var query2 = dbMsSql.SqlQuery <V_Business_ExercisesDetailAndExercisesAnswerDetail_Information>(sql); List <V_Business_ExercisesAndAnswer_Infomation> mainRows = query1.Where(i => i.BusinessExercisesVGUID == Vguid && i.BusinessPersonnelVguid == personalVguid).ToList(); //如果mainRows为0的话则代表此用户没有答过题 if (mainRows.Count == 0) { mainRows = dbMsSql.Queryable <V_Business_ExercisesAndAnswer_Infomation>().Where(i => i.BusinessExercisesVGUID == Vguid).ToList(); mainRows[0].PicturePath = ""; } exerciseAll.MainRow = mainRows; exerciseAll.DetailRow = query2.ToList(); return(exerciseAll); } }
/// <summary> /// 更新支付历史 /// </summary> /// <param name="paymentHistoryInfo">实体信息</param> /// <returns>返回成功与否</returns> public bool UpdatePaymentHistory(Business_Personnel_Information personInfo, Business_PaymentHistory_Information paymentHistoryInfo, Business_PaymentHistory_Information paymentHistoryInfoOld) { using (var db = SugarDao_MsSql.GetInstance()) { db.BeginTran(); try { var configInfo = db.Queryable <Master_Configuration>().Where(i => i.ID == 15).SingleOrDefault(); paymentHistoryInfo.CreateDate = paymentHistoryInfoOld.CreateDate; paymentHistoryInfo.CreateUser = paymentHistoryInfoOld.CreateUser; paymentHistoryInfo.ChangeDate = DateTime.Now; paymentHistoryInfo.ChangeUser = "******"; //插入操作日志表中 string logData = JsonHelper.ModelToJson(paymentHistoryInfo); _logLogic.SaveLog(18, 46, personInfo.UserID + " " + personInfo.Name, "大众出租租赁营收费用", logData); int revenueStauts = 2; if (paymentHistoryInfo.PaymentStatus == "1") { paymentHistoryInfo.PaymentAmount = paymentHistoryInfoOld.PaymentAmount; paymentHistoryInfo.RevenueReceivable = paymentHistoryInfoOld.RevenueReceivable; } paymentHistoryInfo.RevenueStatus = revenueStauts; db.DisableUpdateColumns = new[] { "RevenueType", "WeChatPush_VGUID" }; db.Update <Business_PaymentHistory_Information>(paymentHistoryInfo, i => i.Remarks == paymentHistoryInfoOld.Remarks); db.CommitTran(); return(true); } catch (Exception ex) { LogHelper.WriteLog(ex.ToString()); db.RollbackTran(); return(false); } } }
/// <summary> /// 将支付历史表中营收状态为未匹配的重新插入到营收表(ThirdPartyPublicPlatformPayment)中 /// </summary> /// <returns></returns> public bool Insert2Revenue(Guid vguid) { using (var db = SugarDao_MsSql.GetInstance()) { try { db.BeginTran(); var paymentInfo = db.Queryable <Business_PaymentHistory_Information>().Where(i => i.VGUID == vguid).SingleOrDefault(); var personInfo = db.Queryable <Business_Personnel_Information>().Where(i => i.Vguid == paymentInfo.PaymentPersonnel).SingleOrDefault(); int revenueStatus = 0; var isSuccess = InsertOrUpdateRevenue(paymentInfo, personInfo, ref revenueStatus); if (isSuccess && revenueStatus == 1) { db.Update <Business_PaymentHistory_Information>(new { RevenueStatus = 1 }, i => i.VGUID == vguid); } db.CommitTran(); return(true); } catch (Exception ex) { LogHelper.WriteLog(ex.ToString()); db.RollbackTran(); return(false); } } }
public Business_PaymentHistory_Information GetPaymentHistory(string remarks) { using (var db = SugarDao_MsSql.GetInstance()) { return(db.Queryable <Business_PaymentHistory_Information>().Where(i => i.Remarks == remarks).SingleOrDefault()); } }
public JsonResult IsPointInCircle(string companyVGUID, double lat, double lon) { bool isIn = false; using (SqlSugarClient _db = SugarDao_MsSql.GetInstance()) { var data = _db.SqlQuery <Business_CleaningCompany>(@"select * from Business_CleaningCompany where Vguid=@VGUID", new { VGUID = companyVGUID }).ToList().FirstOrDefault(); string[] sArray = data.TXLocation.Split(new char[1] { ',' }); var circleLat = double.Parse(sArray[0]); var circleLon = double.Parse(sArray[1]); var radius = double.Parse(data.Radius.TryToString()); double R = 6378137.0;//椭球的长半轴 double dLat = (circleLat - lat) * Math.PI / 180; double dLng = (circleLon - lon) * Math.PI / 180; double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) + Math.Cos(lat * Math.PI / 180) * Math.Cos(circleLat * Math.PI / 180) * Math.Sin(dLng / 2) * Math.Sin(dLng / 2); double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a)); double d = R * c; double dis = Math.Round(d); if (dis <= radius) { //点在圆内 isIn = true; } else { isIn = false; } } return(Json(isIn, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取协议类型 /// </summary> /// <returns></returns> public List <Business_ProtocolOperations_Information> GetAgreementTypeList() { using (var db = SugarDao_MsSql.GetInstance()) { return(db.Queryable <Business_ProtocolOperations_Information>().GroupBy(i => i.Result).Select("Result").ToList()); } }
public void AddHomecomingSurvey(Business_HomecomingSurvey hs) { using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance()) { _dbMsSql.Insert(hs); } }
/// <summary> /// 根据微信后台人员状态,更改人员表的状态 /// </summary> /// <param name="user"></param> /// <returns></returns> public bool UpdatePersonStatus(UserList user) { bool result = false; using (var db = SugarDao_MsSql.GetInstance()) { try { switch (user.status) { case "1": //已激活 result = db.Update <Business_Personnel_Information>(new { ApprovalStatus = 2 }, i => i.UserID == user.userid); //已关注 break; case "2": //已禁用 result = db.Update <Business_Personnel_Information>(new { ApprovalStatus = 5 }, i => i.UserID == user.userid); //已禁用 break; case "4": //未激活 result = db.Update <Business_Personnel_Information>(new { ApprovalStatus = 1 }, i => i.UserID == user.userid); //未关注 break; } } catch (Exception exp) { LogManager.WriteLog(LogFile.Error, "同步微信后台,更改Person表人员状态:" + exp.Message); } } return(result); }
public DataTable ExportReturnHomeStatistics(string year, string dept) { DataTable dt = new DataTable(); if (string.IsNullOrEmpty(dept)) { dept = CurrentUser.GetCurrentUser().Department; } //查统计数据 //string sql = string.Format(@"usp_HomecomingSurvey_Total '{0}','{1}'", year, dept); //查明细数据 string sql = string.Format(@"usp_HomecomingSurvey_ExportTotal '{0}','{1}'", year, dept); using (SqlSugarClient dbMsSql = SugarDao_MsSql.GetInstance()) { try { dt = dbMsSql.GetDataTable(sql); dt.TableName = "table"; } catch (Exception ex) { LogHelper.WriteLog(ex.Message); } } return(dt); }
/// <summary> /// 更新用户部门 /// </summary> /// <param name="vguid"></param> /// <param name="personVguid"></param> /// <param name="labelStr"></param> /// <returns></returns> public bool UpdateDepartment(string vguid, string personVguid, string labelStr) { using (SqlSugarClient dbMsSql = SugarDao_MsSql.GetInstance()) { Guid departmentVguid = Guid.Parse(vguid); Guid personVGUID = Guid.Parse(personVguid); bool result = false; var listLabel = JsonHelper.JsonToModel <List <Business_PersonnelLabel_Information> >(labelStr); if (listLabel.Count > 0) { //先删除标签,再重新添加 dbMsSql.Delete <Business_PersonnelLabel_Information>(i => i.PersonnelVVGUID == personVGUID); foreach (var item in listLabel) { item.VGUID = Guid.NewGuid(); item.CreatedDate = DateTime.Now; item.CreatedUser = CurrentUser.GetCurrentUser().LoginName; item.ChangeDate = DateTime.Now; item.ChangeUser = CurrentUser.GetCurrentUser().LoginName; //var rtn = dbMsSql.Insert(item); } result = dbMsSql.SqlBulkCopy(listLabel); //删除空标签 dbMsSql.Delete <Business_PersonnelLabel_Information>(i => i.PersonnelVVGUID == personVGUID && i.LabelName == ""); } result = dbMsSql.Update <Business_Personnel_Information>(new { OwnedFleet = departmentVguid }, i => i.Vguid == personVGUID); return(result); } }
public bool GetPeopleByDepartmentAndLabel(V_Business_WeChatPushMain_Information weChatPushMainInfo, Business_Personnel_Information personInfo) { using (var db = SugarDao_MsSql.GetInstance()) { //说明选择的既有部门又有标签 if (weChatPushMainInfo.Department_VGUID != Guid.Empty && !string.IsNullOrEmpty(weChatPushMainInfo.Label)) { var labArr = weChatPushMainInfo.Label.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var isBelongLabel = db.Queryable <Business_PersonnelLabel_Information>().In(i => i.LabelName, labArr).GroupBy(i => i.PersonnelVVGUID).Any(i => i.PersonnelVVGUID == personInfo.Vguid); if (!isBelongLabel) { return(false); } var isBelongDep = db.SqlQuery <usp_getOrganization>("exec usp_getOrganization @orgvguid", new { orgvguid = weChatPushMainInfo.Department_VGUID }).Any(i => i.UserID == personInfo.UserID); return(isBelongDep); } else if (weChatPushMainInfo.Department_VGUID != Guid.Empty && string.IsNullOrEmpty(weChatPushMainInfo.Label)) //只选了部门 { var isBelongDep = db.SqlQuery <usp_getOrganization>("exec usp_getOrganization @orgvguid", new { orgvguid = weChatPushMainInfo.Department_VGUID }).Any(i => i.UserID == personInfo.UserID); return(isBelongDep); } else if (!string.IsNullOrEmpty(weChatPushMainInfo.Label) && weChatPushMainInfo.Department_VGUID == Guid.Empty) //只选了标签 { var labArr = weChatPushMainInfo.Label.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var isBelongLabel = db.Queryable <Business_PersonnelLabel_Information>().In(i => i.LabelName, labArr).GroupBy(i => i.PersonnelVVGUID).Any(i => i.PersonnelVVGUID == personInfo.Vguid); return(isBelongLabel); } return(db.Queryable <Business_WeChatPushDetail_Information>().Any(i => i.Business_WeChatPushVguid == weChatPushMainInfo.VGUID && i.PushObject == personInfo.UserID)); } }
/// <summary> /// 获取用户的标签信息 /// </summary> /// <param name="personVguid">用户vguid</param> /// <returns></returns> public IEnumerable <string> GetPersonLabel(Guid personVguid) { using (var db = SugarDao_MsSql.GetInstance()) { return(db.Queryable <Business_PersonnelLabel_Information>().GroupBy(i => i.LabelName).Where(i => i.PersonnelVVGUID == personVguid).Select(i => i.LabelName).ToList()); } }
/// <summary> /// 获取登录用户信息 /// </summary> /// <param name="loginName"></param> /// <returns></returns> public V_User_Information GeUserManagement(string loginName) { using (SqlSugarClient sqlSugar = SugarDao_MsSql.GetInstance()) { return(sqlSugar.Queryable <V_User_Information>().Where(i => i.LoginName == loginName).SingleOrDefault()); } }
public void UpdatePhoneNumber(string userid, string phoneNumber) { using (SqlSugarClient dbMsSql = SugarDao_MsSql.GetInstance()) { dbMsSql.Update <Business_Personnel_Information>(new { PhoneNumber = phoneNumber, ApprovalStatus = 4 }, i => i.UserID == userid); } }
/// <summary> /// 审核提交问卷 /// </summary> /// <param name="vguid"></param> /// <returns></returns> public bool CheckedQuestion(string vguid) { using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance()) { bool result = false; Guid Vguid = Guid.Parse(vguid); try { _dbMsSql.BeginTran(); result = _dbMsSql.Update <Business_Questionnaire>(new { Status = 2 }, i => i.Vguid == Vguid); Business_Questionnaire questionInfo = _dbMsSql.Queryable <Business_Questionnaire>().Where(i => i.Vguid == Vguid).SingleOrDefault(); string exerciseJson = JsonHelper.ModelToJson(questionInfo); //存入操作日志表 _ll.SaveLog(9, 52, CurrentUser.GetCurrentUser().LoginName, questionInfo.QuestionnaireName, exerciseJson); _dbMsSql.CommitTran(); } catch (Exception ex) { _dbMsSql.RollbackTran(); Common.LogHelper.LogHelper.WriteLog(ex.ToString()); _ll.SaveLog(5, 52, CurrentUser.GetCurrentUser().LoginName, "", ex.ToString()); } return(result); } }
/// <summary> /// 删除未提交习题 /// </summary> /// <param name="vguid">习题Vguid</param> /// <returns></returns> public bool DeletedExercise(string vguid) { using (SqlSugarClient _dbMsSql = SugarDao_MsSql.GetInstance()) { bool result = false; Guid exerciseVguid = Guid.Parse(vguid); try { _dbMsSql.BeginTran(); Business_Exercises_Infomation exerciseModel = _dbMsSql.Queryable <Business_Exercises_Infomation>().Where(i => i.Vguid == exerciseVguid).SingleOrDefault(); string logData = JsonHelper.ModelToJson(exerciseModel); result = _dbMsSql.Delete <Business_Exercises_Infomation>(i => i.Vguid == exerciseVguid); //删除习题主表 if (result) { _dbMsSql.Delete <Business_ExerciseLibrary_Information>(i => i.BusinessExercisesVguid == exerciseVguid); List <Business_ExercisesDetail_Infomation> exercisesDetail = _dbMsSql.Queryable <Business_ExercisesDetail_Infomation>().Where(i => i.ExercisesInformationVguid == exerciseVguid).ToList(); if (exercisesDetail.Count != 0) { result = _dbMsSql.Delete <Business_ExercisesDetail_Infomation>(i => i.ExercisesInformationVguid == exerciseVguid); //删除习题附表 } } _ll.SaveLog(2, 7, Common.CurrentUser.GetCurrentUser().LoginName, exerciseModel.ExercisesName, logData); _dbMsSql.CommitTran(); } catch (Exception exp) { _dbMsSql.RollbackTran(); Common.LogHelper.LogHelper.WriteLog(exp.ToString()); _ll.SaveLog(5, 7, Common.CurrentUser.GetCurrentUser().LoginName, "", exp.ToString()); } return(result); } }
public JsonResult GetCleaningInfo(string cabOrgName, DateTime?operationDate, string couponType) { List <Business_SecondaryCleaning> cleaningList = new List <Business_SecondaryCleaning>(); using (SqlSugarClient _db = SugarDao_MsSql.GetInstance()) { var year = DateTime.Now.Year; if (operationDate != null) { if (operationDate.Value.Year != year) { year = operationDate.Value.Year; } } cleaningList = _db.SqlQuery <Business_SecondaryCleaning>(@"select CouponType,CabOrgName,month(OperationDate) as 'Description',OperationDate from Business_SecondaryCleaning where year(OperationDate) = @Year and CabOrgName != '' order by OperationDate desc", new { Year = year }); if (cabOrgName != "" && cabOrgName != null) { cleaningList = cleaningList.Where(x => x.CabOrgName.Contains(cabOrgName)).ToList(); } if (operationDate != null) { var lastDate = operationDate.Value.AddMonths(1).AddDays(-1); var newLastDate = (lastDate.ToString("yyyy-MM-dd") + " 23:59:59").ObjToDate(); cleaningList = cleaningList.Where(x => x.OperationDate >= operationDate && x.OperationDate <= newLastDate).ToList(); } if (couponType != "" && couponType != null) { cleaningList = cleaningList.Where(x => x.CouponType == couponType).ToList(); } } return(Json(cleaningList, JsonRequestBehavior.AllowGet)); }
public JsonResult GetCleaningInfo(string cabOrgName, string manOrgName, string couponType, string cabLicense) { List <SecondaryCleaning> cleaningList = new List <SecondaryCleaning>(); using (SqlSugarClient _db = SugarDao_MsSql.GetInstance()) { cleaningList = _db.SqlQuery <SecondaryCleaning>(@"select sc.*,cc.CompanyName from Business_SecondaryCleaning as sc left join Business_CleaningCompany as cc on sc.CompanyVguid = CAST(cc.Vguid as varchar(100)) order by sc.CreatedDate desc ").ToList(); if (cabOrgName != "" && cabOrgName != null) { cleaningList = cleaningList.Where(x => x.CabOrgName.Contains(cabOrgName)).ToList(); } if (manOrgName != "" && manOrgName != null) { cleaningList = cleaningList.Where(x => x.ManOrgName.Contains(manOrgName)).ToList(); } if (couponType != "" && couponType != null) { cleaningList = cleaningList.Where(x => x.CouponType == couponType).ToList(); } if (cabLicense != "" && cabLicense != null) { cleaningList = cleaningList.Where(x => x.CabLicense.Contains(cabLicense)).ToList(); } } return(Json(cleaningList, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 提交草稿知识 /// </summary> /// <param name="vguid">主键</param> /// <returns></returns> public bool SubmitKnowledgeBase(Guid vguid) { using (SqlSugarClient db = SugarDao_MsSql.GetInstance()) { bool result = false; try { db.BeginTran(); result = db.Update <Business_KnowledgeBase_Information>( new { Status = 2, ChangeDate = DateTime.Now, ChangeUser = Common.CurrentUser.GetCurrentUser().LoginName }, i => i.Vguid == vguid); Business_KnowledgeBase_Information knowledgeInfo = db.Queryable <Business_KnowledgeBase_Information>() .Where(i => i.Vguid == vguid) .SingleOrDefault(); string knowledgeJson = JsonHelper.ModelToJson(knowledgeInfo); //存入操作日志表 _ll.SaveLog(8, 40, Common.CurrentUser.GetCurrentUser().LoginName, knowledgeInfo.Title, knowledgeJson); db.CommitTran(); } catch (Exception ex) { db.RollbackTran(); Common.LogHelper.LogHelper.WriteLog(ex.ToString()); _ll.SaveLog(5, 40, Common.CurrentUser.GetCurrentUser().LoginName, "", ex.ToString()); } return(result); } }
/// <summary> /// 判断交易单号是否存在 /// </summary> /// <param name="paymentHistoryInfo"></param> /// <returns></returns> public bool IsExistTransactionId(Business_PaymentHistory_Information paymentHistoryInfo) { using (var db = SugarDao_MsSql.GetInstance()) { return(db.Queryable <Business_PaymentHistory_Information>().Any(i => i.TransactionID == paymentHistoryInfo.TransactionID)); } }