protected void btnBePower_Click(object sender, EventArgs e) { BLL_Two_WayChecklistAuth bll = new BLL_Two_WayChecklistAuth(); List <Model_Two_WayChecklistAuth> listModel = new List <Model_Two_WayChecklistAuth>(); string _bid = Request["bid"]; string _IDs = hidUserIDs.Value.TrimEnd(','); string _dSql = "delete Two_WayChecklistAuth where User_Id in ('" + _IDs.Replace(",", "','") + "') and Two_WayChecklist_Id ='" + _bid + "';"; int result = 0; foreach (string item in _IDs.Split(',')) { if (!string.IsNullOrEmpty(item)) { Model_Two_WayChecklistAuth model = new Model_Two_WayChecklistAuth(); model.Two_WayChecklistAuth_Id = Guid.NewGuid().ToString(); model.User_Id = item; model.Two_WayChecklist_Id = _bid; model.Auth_Type = UserOrder_PaytoolEnum.NBSQ.ToString();//内部授权 model.CreateTime = DateTime.Now; model.CreateUser = loginUser.SysUser_ID; listModel.Add(model); } } try { Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(_dSql); foreach (var item in listModel) { bool flag = bll.Add(item); if (flag) { new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS(Module_Id, string.Format("给老师授权成功,操作人:{0},资源标识:{1},老师标识:{2}" , loginUser.SysUser_ID, item.Two_WayChecklist_Id, item.User_Id)); } else { new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS(Module_Id, string.Format("给老师授权失败,操作人:{0},资源标识:{1},老师标识:{2}" , loginUser.SysUser_ID, item.Two_WayChecklist_Id, item.User_Id)); } result += flag == true ? 1 : 0; } ShowMsg(result > 0 ? true : false, "操作成功!"); } catch (Exception ex) { //记录错误日志 new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS(Module_Id, string.Format("给老师授权失败,操作人:{0},类:{1},方法{2},错误信息:{3}" , loginUser.SysUser_ID , ex.TargetSite.DeclaringType.ToString() , ex.TargetSite.Name.ToString() , ex.Message)); ShowMsg(false, "操作失败!"); return; } }
public bool Add(Model_Two_WayChecklistAuth model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Two_WayChecklistAuth("); builder.Append("Two_WayChecklistAuth_Id,User_Id,Two_WayChecklist_Id,Auth_Type,Remark,CreateUser,CreateTime)"); builder.Append(" values ("); builder.Append("@Two_WayChecklistAuth_Id,@User_Id,@Two_WayChecklist_Id,@Auth_Type,@Remark,@CreateUser,@CreateTime)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@Two_WayChecklistAuth_Id", SqlDbType.Char, 0x24), new SqlParameter("@User_Id", SqlDbType.Char, 0x24), new SqlParameter("@Two_WayChecklist_Id", SqlDbType.Char, 0x24), new SqlParameter("@Auth_Type", SqlDbType.VarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 500), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime) }; cmdParms[0].Value = model.Two_WayChecklistAuth_Id; cmdParms[1].Value = model.User_Id; cmdParms[2].Value = model.Two_WayChecklist_Id; cmdParms[3].Value = model.Auth_Type; cmdParms[4].Value = model.Remark; cmdParms[5].Value = model.CreateUser; cmdParms[6].Value = model.CreateTime; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_Two_WayChecklistAuth> DataTableToList(DataTable dt) { List <Model_Two_WayChecklistAuth> list = new List <Model_Two_WayChecklistAuth>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_Two_WayChecklistAuth item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Update(Model_Two_WayChecklistAuth model) { StringBuilder builder = new StringBuilder(); builder.Append("update Two_WayChecklistAuth set "); builder.Append("User_Id=@User_Id,"); builder.Append("Two_WayChecklist_Id=@Two_WayChecklist_Id,"); builder.Append("Auth_Type=@Auth_Type,"); builder.Append("Remark=@Remark,"); builder.Append("CreateUser=@CreateUser,"); builder.Append("CreateTime=@CreateTime"); builder.Append(" where Two_WayChecklistAuth_Id=@Two_WayChecklistAuth_Id "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@User_Id", SqlDbType.Char, 0x24), new SqlParameter("@Two_WayChecklist_Id", SqlDbType.Char, 0x24), new SqlParameter("@Auth_Type", SqlDbType.VarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 500), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Two_WayChecklistAuth_Id", SqlDbType.Char, 0x24) }; cmdParms[0].Value = model.User_Id; cmdParms[1].Value = model.Two_WayChecklist_Id; cmdParms[2].Value = model.Auth_Type; cmdParms[3].Value = model.Remark; cmdParms[4].Value = model.CreateUser; cmdParms[5].Value = model.CreateTime; cmdParms[6].Value = model.Two_WayChecklistAuth_Id; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public Model_Two_WayChecklistAuth DataRowToModel(DataRow row) { Model_Two_WayChecklistAuth auth = new Model_Two_WayChecklistAuth(); if (row != null) { if (row["Two_WayChecklistAuth_Id"] != null) { auth.Two_WayChecklistAuth_Id = row["Two_WayChecklistAuth_Id"].ToString(); } if (row["User_Id"] != null) { auth.User_Id = row["User_Id"].ToString(); } if (row["Two_WayChecklist_Id"] != null) { auth.Two_WayChecklist_Id = row["Two_WayChecklist_Id"].ToString(); } if (row["Auth_Type"] != null) { auth.Auth_Type = row["Auth_Type"].ToString(); } if (row["Remark"] != null) { auth.Remark = row["Remark"].ToString(); } if (row["CreateUser"] != null) { auth.CreateUser = row["CreateUser"].ToString(); } if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != "")) { auth.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString())); } } return(auth); }
public bool Add(Model_Two_WayChecklistAuth model) { return(this.dal.Add(model)); }
public bool Update(Model_Two_WayChecklistAuth model) { return(this.dal.Update(model)); }