| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using SyntacticSugar.constant; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //获取当前用户身份列表 |
| | | string sql = "select HLev from System_UserGroupInfo u " + |
| | | " left join System_UserGroup r " + |
| | | "on u.GroupId = r.GroupID where u.UserId = '" + HCzybm + "'"; |
| | | |
| | | //用户身份判断 |
| | | DataSet hLev = oCN.RunProcReturn(sql, "System_UserGroupInfo"); |
| | | foreach(DataRow dr in hLev.Tables[0].Rows) |
| | | { |
| | | if (!dr["HLev"].Equals(RoleConstant.EMPLOYEE)) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "管理员身份不允许删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | //删除用户信息 |
| | | oCN.RunProc("delete from Gy_Czygl where Czybm='" + HCzybm + "'"); |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //判断用户数是否大于客户账号数 |
| | | ds = oCN.RunProcReturn("Exec h_p_Xt_BaseInfo ", "h_p_Xt_BaseInfo"); |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.RunProc("insert into Gy_Czygl (Czybm,Czymc,Czmm,Explain,HempID,HK3UserID " + |
| | | ",HKeeperID,HKeeper,HSecManagerID,HSecManager " + |
| | | ",HSellManID,HSellMan,HDeptID,HDept " + |
| | | ",HWhID,HWHName,HSupID,HSupName " + |
| | | ",HSCWHID,HSCWHName " + |
| | | ",HCloudUserName,HCloudUserPsd,HUSEORGID,HProcID" + |
| | | ",HGroupID,HSourceID,HCheckEmpID,HWorkCenterID,HICNumber) " + |
| | | ",HGroupID,HSourceID,HCheckEmpID,HWorkCenterID,HICNumber,HDingDingUserID) " + |
| | | "values ('" + lsmain[0].Czybm.ToString() + "','" + lsmain[0].Czymc.ToString() + "','" + ClsPub.StrToPsd(lsmain[0].Czmm.ToString()) + "','" + lsmain[0].Explain.ToString() + "','" + lsmain[0].HEmpID.ToString() + "',"+ lsmain[0].HK3UserID.ToString() + "" + |
| | | ","+ lsmain[0].HKeeperID.ToString() + ",'"+ lsmain[0].HKeeper.ToString() + "',"+ lsmain[0].HSecManagerID.ToString() + ",'"+ lsmain[0].HSecManager.ToString() + "'" + |
| | | "," + lsmain[0].HSellManID.ToString() + ",'" + lsmain[0].HSellMan.ToString() + "'," + lsmain[0].HDeptID.ToString() + ",'" + lsmain[0].HDept.ToString() + "'" + |
| | | "," + lsmain[0].HWhID.ToString() + ",'" + lsmain[0].HWHName.ToString() + "'," + lsmain[0].HSupID.ToString() + ",'" + lsmain[0].HSupName.ToString() + "'" + |
| | | "," + lsmain[0].HSCWHID.ToString() + ",'" + lsmain[0].HSCWHName.ToString() + "'" + |
| | | ",'" + lsmain[0].HCloudUserName.ToString() + "','" + lsmain[0].HCloudUserPsd.ToString() + "',"+ lsmain[0].HOrgID.ToString() + "," + lsmain[0].HProcID.ToString() + "" + |
| | | ","+ lsmain[0].HGroupID.ToString() + ","+ lsmain[0].HSourceID.ToString() + "," + lsmain[0].HCheckEmpID.ToString() + "," + lsmain[0].HWorkCenterID.ToString() + ",'" + lsmain[0].HICNumber + "'" + ")"); |
| | | ","+ lsmain[0].HGroupID.ToString() + ","+ lsmain[0].HSourceID.ToString() + "," + lsmain[0].HCheckEmpID.ToString() + "," + lsmain[0].HWorkCenterID.ToString() + ",'" + lsmain[0].HICNumber + "','" + lsmain[0].HDingDingUserID + "'" + ")"); |
| | | |
| | | //新增后查询 确保数据添加成功 |
| | | ds = oCN.RunProcReturn("Select * from Gy_Czygl where Czybm='" + lsmain[0].Czybm.ToString() + "'", "Gy_Czygl"); |
| | |
| | | } |
| | | else //修改 |
| | | { |
| | | //判断用户数是否大于客户账号数 |
| | | ds = oCN.RunProcReturn("Exec h_p_Xt_BaseInfo ", "h_p_Xt_BaseInfo"); |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from Gy_Czygl where Czybm='" + lsmain[0].Czybm.ToString() + "'", "Gy_Czygl"); |
| | | if (ds.Tables[0].Rows[0]["Czmm"].ToString() != lsmain[0].Czmm) //修改密码 |
| | | { |
| | |
| | | ",HCloudUserPsd='" + lsmain[0].HCloudUserPsd.ToString() + "'" + |
| | | ",HUSEORGID=" + lsmain[0].HOrgID.ToString() + |
| | | ",HICNumber='" + lsmain[0].HICNumber + "'" + |
| | | ",HDingDingUserID='" + lsmain[0].HDingDingUserID + "'" + |
| | | " where Czybm='" + lsmain[0].Czybm.ToString() + "'"); |
| | | } |
| | | else |
| | |
| | | ",HCloudUserName='" + lsmain[0].HCloudUserName.ToString() + "'" + |
| | | ",HCloudUserPsd='" + lsmain[0].HCloudUserPsd.ToString() + "'" + |
| | | ",HUSEORGID=" + lsmain[0].HOrgID.ToString() + |
| | | ",HICNumber='" + lsmain[0].HICNumber + "'" + |
| | | ",HICNumber='" + lsmain[0].HICNumber + "'" + |
| | | ",HDingDingUserID='" + lsmain[0].HDingDingUserID + "'" + |
| | | " where Czybm='" + lsmain[0].Czybm.ToString() + "'"); |
| | | } |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 用户关联部门查询 |
| | | /// <summary> |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Xt_User/UserRelationDeptlist")] |
| | | [HttpGet] |
| | | public object UserRelationDeptlist(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationDept_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = ""; |
| | | |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | sql = "select * from h_v_Gy_UserDeptRelationList_Query order by 用户代码 asc,部门代码 asc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_UserDeptRelationList_Query"); |
| | | } |
| | | else |
| | | { |
| | | sql = "select * from h_v_Gy_UserDeptRelationList_Query where 1=1 "; |
| | | sql = sql + sWhere + " order by 用户代码 asc,部门代码 asc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_UserDeptRelationList_Query"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 用户关联部门 根据用户ID查找 |
| | | /// <summary> |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Xt_User/UserRelationDeptlist_EditInit")] |
| | | [HttpGet] |
| | | public object UserRelationDeptlist_EditInit(int HItemID, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationDept_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = "select * from h_v_Gy_UserDeptRelationList_Query where HItemID = " + HItemID; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_UserDeptRelationList_Query"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 用户关联部门 删除 |
| | | /// <summary> |
| | | ///参数:string HInterID。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Xt_User/UserRelationDeptlist_Drop")] |
| | | [HttpGet] |
| | | public object UserRelationDeptlist_Drop(string HInterID, string user) |
| | | { |
| | | try |
| | | { |
| | | string s = ""; |
| | | |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_UserRelationDept_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无删除权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (HInterID == null || HInterID.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | string sql = "delete from Gy_UserDeptRelation where HItemID = " + HInterID; |
| | | oCN.RunProc(sql); |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 根据用户编码查找已分配工作中心列表 |
| | | [Route("Xt_User/UserWorkCenterlistPlaylist")] |
| | | [HttpGet] |