/// <summary> /// 新建菜单 /// </summary> /// <param name="model"></param> /// <returns></returns> public int EditMenu(Sys_MenuInfo model) { int result = 0; try { SqlParameter[] param = { new SqlParameter("@Id", model.Id), new SqlParameter("@Name", model.Name), new SqlParameter("@Pid", model.Pid), new SqlParameter("@Url", model.Url), new SqlParameter("@Description", model.Description), new SqlParameter("@IsMenu", model.IsMenu), new SqlParameter("@IsShow", model.IsShow), new SqlParameter("@MenuCode", model.MenuCode) }; object obj = SQLHelp.ExecuteScalar("EditMenu", CommandType.StoredProcedure, param); result = Convert.ToInt32(obj); } catch (Exception ex) { LogService.WriteErrorLog(ex.Message); } return(result); }
/// <summary> /// 章节删除 /// </summary> /// <param name="chapter"></param> /// <param name="ID">章节ID</param> /// <returns></returns> public string DelChapter(int ID) { SqlParameter[] param = { new SqlParameter("@ChapterID", ID) }; object obj = SQLHelp.ExecuteScalar("DelChapter", CommandType.StoredProcedure, param); return(obj.ToString()); }
public int Add_RewardBatchDetail(int batchid, string achieve_Ids, string createUID) { int result = 0; List <SqlParameter> pms = new List <SqlParameter>(); StringBuilder str = new StringBuilder(); pms.Add(new SqlParameter("@RewardBatch_Id", batchid)); pms.Add(new SqlParameter("@CreateUID", createUID)); string[] achArray = achieve_Ids.Split(','); if (achArray.Length > 0) { for (int i = 0; i < achArray.Length; i++) { pms.Add(new SqlParameter("@Acheive_Id" + i, achArray[i])); string achsql = "select Id from TPM_RewardBatchDetail where RewardBatch_Id=@RewardBatch_Id and Acheive_Id=@Acheive_Id" + i + " and IsDelete=0"; int allotid = Convert.ToInt32(SQLHelp.ExecuteScalar(achsql, CommandType.Text, pms.ToArray())); if (allotid <= 0) { str.Append(@"insert into TPM_RewardBatchDetail(RewardBatch_Id,Acheive_Id,CreateUID) values(@RewardBatch_Id,@Acheive_Id" + i + ",@CreateUID);"); } } result = SQLHelp.ExecuteNonQuery(str.ToString(), CommandType.Text, pms.ToArray()); } return(result); }
private void Del_RewardEdition(HttpContext context) { try { int itemid = Convert.ToInt32(context.Request["ItemId"]); //是否已经引用 int useCount = Convert.ToInt32(SQLHelp.ExecuteScalar("select count(1) from TPM_AcheiveRewardInfo where IsDelete=0 and LID=" + RequestHelper.int_transfer(context.Request, "LID") + " and convert(varchar(10),DefindDate,21) between '" + context.Request["beginTime"] + "' and '" + context.Request["endTime"] + "'", CommandType.Text, null)); if (useCount > 0) { jsonModel = JsonModel.get_jsonmodel(-1, "该版本已经被使用!", ""); return; } jsonModel = RewardEdition_bll.DeleteFalse(itemid); if (jsonModel.errNum == 0) { new Sys_DocumentService().DelDocByRelId(1, itemid);//删除版本相关文件 } } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; LogService.WriteErrorLog(ex.Message); } }
public int EditDepartActivity(Acti_Activity model, string projectStr) { int result = 0; SqlParameter[] param = { new SqlParameter("@Id", model.Id), new SqlParameter("@DepartId", model.DepartId), new SqlParameter("@OrganizeUserNO", model.OrganizeUserNO), new SqlParameter("@Name", model.Name), new SqlParameter("@Range", model.Range), new SqlParameter("@Type", model.Type), new SqlParameter("@ActStartTime", model.ActStartTime), new SqlParameter("@ActEndTime", model.ActEndTime), new SqlParameter("@Introduction", model.Introduction), new SqlParameter("@EntStartTime", model.EntStartTime), new SqlParameter("@EntEndTime", model.EntEndTime), new SqlParameter("@Address", model.Address), new SqlParameter("@Awards", model.Awards), new SqlParameter("@AttachUrl", model.AttachUrl), new SqlParameter("@ActivityImg", model.ActivityImg), new SqlParameter("@SendExamStatus", model.SendExamStatus), new SqlParameter("@CreateUID", model.CreateUID), new SqlParameter("@EditUID", model.EditUID ?? ""), new SqlParameter("@ProjectStr", projectStr) }; object obj = SQLHelp.ExecuteScalar("EditDepartActivity", CommandType.StoredProcedure, param); result = Convert.ToInt32(obj); return(result); }
/// <summary> /// 添加单条数据 /// </summary> /// <param name="entity"></param> /// <returns></returns> public virtual int Add(T entity) { string sql = string.Empty; List <SqlParameter> pms = DalAddHelp(entity, out sql); return(Convert.ToInt32(SQLHelp.ExecuteScalar(sql, System.Data.CommandType.Text, pms.ToArray()))); }
private void Del_RewardEdition(HttpContext context) { try { int itemid = Convert.ToInt32(context.Request["ItemId"]); int useCount = Convert.ToInt32(SQLHelp.ExecuteScalar("select count(1) from TPM_AcheiveRewardInfo a left join TPM_RewardLevel lev on lev.Id = a.Lid where a.IsDelete = 0 and lev.EID =" + itemid, CommandType.Text, null));//是否已经引用 if (useCount > 0) { jsonModel = JsonModel.get_jsonmodel(-1, "该版本已经被使用!", ""); return; } jsonModel = RewardEdition_bll.DeleteFalse(itemid); if (jsonModel.errNum == 0) { new Sys_DocumentService().DelDocByRelId(1, itemid);//删除版本相关文件 } } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; LogService.WriteErrorLog(ex.Message); } }
/// <summary> /// 添加课程 /// </summary> /// <param name="entity"></param> /// <returns></returns> public string UpdateCourse(Course_Manage entity, string Class) { SqlParameter[] param = { new SqlParameter("@ID",entity.ID), new SqlParameter("@Name",entity.Name), new SqlParameter("@ImageUrl", entity.ImageUrl), new SqlParameter("@CourceType",entity.CourceType), new SqlParameter("@Status", entity.Status), new SqlParameter("@StuMaxCount", entity.StuMaxCount), new SqlParameter("@CourseIntro",entity.CourseIntro), new SqlParameter("@StudyTerm", entity.StudyTerm), new SqlParameter("@GradeID",entity.GradeID), new SqlParameter("@WeekName",entity.WeekName), new SqlParameter("@StartTime",entity.StartTime), new SqlParameter("@EndTime",entity.EndTime), new SqlParameter("@EvalueStandard",entity.EvalueStandard), new SqlParameter("@CourseHardware",entity.CourseHardware), new SqlParameter("@StudyPlace",entity.StudyPlace), new SqlParameter("@Class",Class) }; object obj = SQLHelp.ExecuteScalar("UpdateCourse", CommandType.StoredProcedure, param); string result = ""; if (obj.ToString().Length > 0) { result = obj.ToString(); } return result; }
/// <summary> /// 添加学期 /// </summary> /// <param name="model"></param> /// <param name="Small"></param> /// <param name="SmallL"></param> /// <param name="Center"></param> /// <param name="CenterL"></param> /// <param name="High"></param> /// <param name="HighL"></param> /// <returns></returns> public string AddSection(Sys_StudySection model, string Small, string SmallL, string Center, string CenterL, string High, string HighL) { string retult = ""; try { SqlParameter[] pa = { new SqlParameter("@Academic", model.Academic), new SqlParameter("@Semester", model.Semester), new SqlParameter("@StartDate", model.StartDate), new SqlParameter("@EndDate", model.EndDate), new SqlParameter("@IsDelete", model.IsDelete), new SqlParameter("@PeriodIDs", model.PeriodIDs), new SqlParameter("@Small", Small), new SqlParameter("@SmallL", SmallL), new SqlParameter("@Center", Center), new SqlParameter("@CenterL", CenterL), new SqlParameter("@High", High), new SqlParameter("@HighL", HighL) }; object obj = SQLHelp.ExecuteScalar("AddSection", CommandType.StoredProcedure, pa); retult = obj.SafeToString(); } catch (Exception ex) { LogService.WriteErrorLog(ex.Message); } return(retult); }
public string AddAcheiveRewardInfo(TPM_AcheiveRewardInfo entity) { SqlParameter[] param = { new SqlParameter("@Name", entity.Name), new SqlParameter("@Gid", entity.Gid), new SqlParameter("@GPid", entity.GPid), new SqlParameter("@BookId", entity.BookId), new SqlParameter("@TeaUNo", entity.TeaUNo), new SqlParameter("@Lid", entity.Lid), new SqlParameter("@Rid", entity.Rid), new SqlParameter("@Sort", entity.Sort), new SqlParameter("@Year", entity.Year), new SqlParameter("@ResponsMan", entity.ResponsMan), new SqlParameter("@DepartMent", entity.DepartMent), new SqlParameter("@FileEdionNo", entity.FileEdionNo), new SqlParameter("@FileNames", entity.FileNames), new SqlParameter("@DefindDepart", entity.DefindDepart), new SqlParameter("@DefindDate", entity.DefindDate), new SqlParameter("@FileInfo", entity.FileInfo), new SqlParameter("@Status", entity.Status), new SqlParameter("@CreateUID", entity.CreateUID) }; object obj = SQLHelp.ExecuteScalar("TPM_AddAcheiveRewardInfo", CommandType.StoredProcedure, param); return(obj.ToString()); }
private string GetCurrentTerm() { string strSql = "select Id from Sys_StudySection where StartDate<getdate() and EndDate>getdate()"; object Obj = SQLHelp.ExecuteScalar(strSql, CommandType.Text, null); return(Obj.ToString()); }
/// <summary> /// 判断名称是否已存在 /// </summary> /// <param name="entity">实体</param> /// <param name="fieldvalue">字段值</param> /// <param name="fieldname">字段名称</param> /// <param name="Id">主键</param> /// <returns></returns> public virtual bool IsNameExists(T entity, string where, List <SqlParameter> pms) { string sql = string.Format("select COUNT(1) from {0} where {1} ", entity.GetType().Name, where); object obj = SQLHelp.ExecuteScalar(sql, CommandType.Text, pms.ToArray()); return(int.Parse(obj.ToString()) > 0); }
/// <summary> /// 编辑联系人edit_cust_linkman /// </summary> /// <param name="model"></param> /// <returns></returns> public static int edit_cust_linkman(cust_linkman model) { int result = 0; SqlParameter[] param = { new SqlParameter("@id", model.id), new SqlParameter("@link_cust_id", model.link_cust_id == null?0:model.link_cust_id), new SqlParameter("@link_name", model.link_name == null?"":model.link_name), new SqlParameter("@link_department", model.link_department == null?"":model.link_department), new SqlParameter("@link_position", model.link_position == null?"":model.link_position), new SqlParameter("@link_level", model.link_level == null?0:model.link_level), new SqlParameter("@link_sex", model.link_sex == null?"":model.link_sex), new SqlParameter("@link_birthday", model.link_birthday), new SqlParameter("@link_phonenumber", model.link_phonenumber == null?"":model.link_phonenumber), new SqlParameter("@link_telephone", model.link_telephone == null?"":model.link_telephone), new SqlParameter("@link_email", model.link_email == null?"":model.link_email), new SqlParameter("@link_status", model.link_status == null?"":model.link_status), new SqlParameter("@link_users", model.link_users == null?"0":model.link_users), new SqlParameter("@link_usersname", model.link_usersname == null?"":model.link_usersname), new SqlParameter("@link_isdelete", model.link_isdelete), new SqlParameter("@link_cust_name", model.link_cust_name == null?"":model.link_cust_name) }; result = Convert.ToInt32(SQLHelp.ExecuteScalar("edit_cust_linkman", System.Data.CommandType.StoredProcedure, param.ToArray())); return(result); }
//进度显示 //void bcp_SqlRowsCopied(object sender, System.Data.SqlClient.SqlRowsCopiedEventArgs e) //{ // this.Text = e.RowsCopied.ToString(); // this.Update(); //} #endregion #region 统计不同组织机构用户数目(非学生) /// <summary> /// 统计不同组织机构用户数目 /// </summary> /// <returns></returns> public int censusUser(string RegisterOrg, string AuthenType) { int retult = 0; try { string strSql = "select count(1) from Sys_UserInfo where 1=1"; if (RegisterOrg.Length > 0) { GetAllOrgNo(RegisterOrg); string orgArry = "'" + sb.ToString().Replace(",", "','") + "'"; //str.Append(" and userInfo.RegisterOrg in (" + orgArry + ")"); strSql += " and RegisterOrg in (" + orgArry + ")"; } if (AuthenType.Length > 0) { strSql += " and AuthenType in (" + AuthenType + ")"; } object obj = SQLHelp.ExecuteScalar(strSql, CommandType.Text, null); retult = Convert.ToInt32(obj); } catch (Exception ex) { LogService.WriteErrorLog(ex.Message); } return(retult); }
/// <summary> /// 编辑用户 /// </summary> /// <param name="model"></param> /// <returns></returns> public string EditUserInfo(Sys_UserInfo model) { string retult = ""; try { SqlParameter[] pa = { new SqlParameter("@ID", model.Id), new SqlParameter("@IDCard", model.IDCard), new SqlParameter("@LoginName", model.LoginName), new SqlParameter("@Name", model.Name), new SqlParameter("@Sex", model.Sex), new SqlParameter("@Address", model.Address), new SqlParameter("@Phone", model.Phone), new SqlParameter("@Nickname", model.Nickname), new SqlParameter("@UserType", model.UserType), new SqlParameter("@Birthday", model.Birthday.SafeToString() == ""?DateTime.Now:model.Birthday), new SqlParameter("@Remarks", model.Remarks), new SqlParameter("@HeadPic", model.HeadPic), new SqlParameter("@Password", model.Password), new SqlParameter("@IsFirstLogin", model.IsFirstLogin), new SqlParameter("@Email", model.Email.SafeToString()) }; object obj = SQLHelp.ExecuteScalar("EditUserInfo", CommandType.StoredProcedure, pa); retult = obj.SafeToString(); } catch (Exception ex) { LogService.WriteErrorLog(ex.Message); } return(retult); }
/// <summary> /// 复制学期 /// </summary> /// <param name="id">学期ID</param> /// <returns></returns> public string CopySection(Sys_StudySection model, int IsUp) { string retult = ""; try { SqlParameter[] pa = { new SqlParameter("@OldSectionID", model.Id), new SqlParameter("@Academic", model.Academic), new SqlParameter("@Semester", model.Semester), new SqlParameter("@StartDate", model.StartDate), new SqlParameter("@EndDate", model.EndDate), new SqlParameter("@IsDelete", model.IsDelete), new SqlParameter("@IsUp", IsUp), }; object obj = SQLHelp.ExecuteScalar("CopySection", CommandType.StoredProcedure, pa); retult = obj.SafeToString(); } catch (Exception ex) { LogService.WriteErrorLog(ex.Message); } return(retult); }
/// <summary> /// 添加班级 /// </summary> /// <param name="model"></param> /// <returns></returns> public string AddClass(Sys_ClassInfo model, int GradeId, int AcademicId) { string retult = ""; try { SqlParameter[] pa = { new SqlParameter("@ClassName", model.ClassName), new SqlParameter("@ClassNO", model.ClassNO), new SqlParameter("@HeadteacherNO", model.HeadteacherNO), new SqlParameter("@MonitorNO", model.MonitorNO), new SqlParameter("@CreateUID", model.CreateUID), new SqlParameter("@GradeId", GradeId), new SqlParameter("@AcademicId", AcademicId), }; object obj = SQLHelp.ExecuteScalar("AddClass", CommandType.StoredProcedure, pa); retult = obj.SafeToString(); } catch (Exception ex) { LogService.WriteErrorLog(ex.Message); } return(retult); }
/// <summary> /// 组织架构修改 /// </summary> /// <param name="model"></param> /// <returns></returns> public string EditOrg(Org_Mechanism model) { string retult = ""; try { SqlParameter[] pa = { new SqlParameter("@ID", model.Id.ToString()), new SqlParameter("@Name", model.Name), new SqlParameter("@OrganNo", model.OrganNo.SafeToString()), new SqlParameter("@Pid", model.Pid), new SqlParameter("@OrganType", model.OrganType.ToString()), new SqlParameter("@Introduce", model.Introduce.SafeToString()), new SqlParameter("@LegalUID", model.LegalUID.SafeToString()), new SqlParameter("@Establish", model.EstabLish.ToString()), new SqlParameter("@ImageInfo", model.ImageInfo.SafeToString()), new SqlParameter("@IsDelete", model.IsDelete.ToString()), new SqlParameter("@UserCount", model.UserCount.ToString()) }; object obj = SQLHelp.ExecuteScalar("EditOrg", CommandType.StoredProcedure, pa); retult = obj.SafeToString(); } catch (Exception ex) { LogService.WriteErrorLog(ex.Message); } return(retult); }
/// <summary> /// 自动调整报名人员 /// </summary> /// <param name="CouseIDArry">课程ID串</param> /// <returns></returns> public string StuSingUp(string CouseIDArry) { SqlParameter[] param = { new SqlParameter("@CouseIDArry",CouseIDArry) }; return SQLHelp.ExecuteScalar("StuAdJust", CommandType.StoredProcedure, param).ToString(); }
public string TPM_RewardLevelSort(int id, string SortType) { SqlParameter[] param = { new SqlParameter("@ID", id), new SqlParameter("@SortType",SortType) }; object obj = SQLHelp.ExecuteScalar("TPM_RewardLevelSort", CommandType.StoredProcedure, param); return obj.ToString(); }
public string DeleteModelMenu(int ID) { string result = ""; SqlParameter[] pa = { new SqlParameter("@ID", ID) }; object obj = SQLHelp.ExecuteScalar("DelModelMenu", CommandType.StoredProcedure, pa); result = obj.ToString(); return(result); }
public int GetRewardScore_UseCount(int Reward_Id) { string str = "select count(1) from TPM_AcheiveRewardInfo where IsDelete=0 and (Status=5 or Status>6) and Rid=@Rid"; List <SqlParameter> op_pms = new List <SqlParameter>(); op_pms.Add(new SqlParameter("@Rid", Reward_Id)); int result = Convert.ToInt32(SQLHelp.ExecuteScalar(str, CommandType.Text, op_pms.ToArray())); return(result); }
public decimal GetRewardBatch_UseMoney(int RewardBatch_Id) { string str = "select ISNULL(sum(Money),0) from TPM_RewardBatchDetail where IsDelete=0 and RewardBatch_Id=@RewardBatch_Id"; List <SqlParameter> op_pms = new List <SqlParameter>(); op_pms.Add(new SqlParameter("@RewardBatch_Id", RewardBatch_Id)); int result = Convert.ToInt32(SQLHelp.ExecuteScalar(str, CommandType.Text, op_pms.ToArray())); return(result); }
private int IsExistSameISBN(string isbn, int id = 0) { string sql = "select count(1) from TPM_BookStory where IsDelete=0 and Status=3 and ISBN='" + isbn + "'"; if (id != 0) { sql += " and Id!=" + id; } return(Convert.ToInt32(SQLHelp.ExecuteScalar(sql, CommandType.Text, null))); }
/// <summary> /// 报名 /// </summary> /// <param name="courseid">课程编号</param> /// <param name="stuno">学生编号</param> /// <returns></returns> public string StuSingUp(string courseid, string stuno,int Rank) { SqlParameter[] param = { new SqlParameter("@CouseID",courseid), new SqlParameter("@StuNo", stuno), new SqlParameter("@Rank",Rank) }; return SQLHelp.ExecuteScalar("StuSingUp", CommandType.StoredProcedure, param).ToString(); }
public int GetRewardMoney_UseCount(int RewardBatch_Id) { string str = "select count(1) from TPM_RewardBatchDetail where IsDelete=0 and Status in(1,3) and RewardBatch_Id=@RewardBatch_Id"; List <SqlParameter> op_pms = new List <SqlParameter>(); op_pms.Add(new SqlParameter("@RewardBatch_Id", RewardBatch_Id)); int result = Convert.ToInt32(SQLHelp.ExecuteScalar(str, CommandType.Text, op_pms.ToArray())); return(result); }
public int[] Oper_AuditAllotReward(TPM_AuditReward audModel, List <TPM_AllotReward> items) { int result = 0; List <SqlParameter> pms = new List <SqlParameter>(); StringBuilder str = new StringBuilder(); pms.Add(new SqlParameter("@Acheive_Id", audModel.Acheive_Id)); pms.Add(new SqlParameter("@RewardBatch_Id", audModel.RewardBatch_Id)); string sql = "select Id from TPM_AuditReward where Acheive_Id=@Acheive_Id and RewardBatch_Id=@RewardBatch_Id and IsDelete=0"; int auditid = Convert.ToInt32(SQLHelp.ExecuteScalar(sql, CommandType.Text, pms.ToArray())); if (auditid > 0) { pms.Add(new SqlParameter("@Status", audModel.Status)); str.Append("update TPM_AuditReward set Status=@Status where Id=@Audit_Id;"); } else { auditid = new TPM_AuditRewardDal().Add(audModel); } pms.Add(new SqlParameter("@Audit_Id", auditid)); if (items.Count() > 0) { for (int i = 0; i < items.Count; i++) { TPM_AllotReward item = items[i]; if (item.AllotMoney == null) { pms.Add(new SqlParameter("@AllotMoney" + i, DBNull.Value)); } else { pms.Add(new SqlParameter("@AllotMoney" + i, item.AllotMoney)); } pms.Add(new SqlParameter("@RewardUser_Id" + i, item.RewardUser_Id)); pms.Add(new SqlParameter("@CreateUID" + i, item.CreateUID)); pms.Add(new SqlParameter("@EditUID" + i, item.CreateUID)); string allotsql = "select Id from TPM_AllotReward where Audit_Id=@Audit_Id and RewardUser_Id=@RewardUser_Id" + i + " and IsDelete=0"; int allotid = Convert.ToInt32(SQLHelp.ExecuteScalar(allotsql, CommandType.Text, pms.ToArray())); if (allotid > 0) { pms.Add(new SqlParameter("@Id" + i, allotid)); str.Append("update TPM_AllotReward set AllotMoney=@AllotMoney" + i + ",EditUID=@EditUID" + i + " where Id=@Id" + i + ";"); } else { str.Append(@"insert into TPM_AllotReward(Audit_Id,AllotMoney,RewardUser_Id,CreateUID) values(@Audit_Id,@AllotMoney" + i + ",@RewardUser_Id" + i + ",@CreateUID" + i + ");"); } } result = SQLHelp.ExecuteNonQuery(str.ToString(), CommandType.Text, pms.ToArray()); } return(new int[] { result, auditid }); }
public string DelCourse(string courseid) { SqlParameter[] param = { new SqlParameter("@ID",courseid)}; object obj = SQLHelp.ExecuteScalar("DelCourse", CommandType.StoredProcedure, param); string result = ""; if (obj.ToString().Length > 0) { result = obj.ToString(); } return result; }
/// <summary> /// 新增-修改 业绩等级 /// </summary> /// <param name="model"></param> /// <returns></returns> public string TPM_AcheiveLevelAdd(TPM_AcheiveLevel model) { SqlParameter[] param = { new SqlParameter("@Name", model.Name), new SqlParameter("@Pid", model.Pid), new SqlParameter("@ID", model.Id), }; object obj = SQLHelp.ExecuteScalar("TPM_AcheiveLevelAdd", CommandType.StoredProcedure, param); return(obj.ToString()); }
public string GoodClick(Com_GoodClick model) { SqlParameter[] param = { new SqlParameter("@Type", model.Type), new SqlParameter("@RelationId", model.RelationId), new SqlParameter("@CreateUID", model.CreateUID) }; object obj = SQLHelp.ExecuteScalar("GoodClick", CommandType.StoredProcedure, param); return(obj.ToString()); }