/// <summary> /// VEX框架的主入口 /// </summary> /// <returns></returns> public DataSet GetData() { DataSet ds_Return = new DataSet(); DataTable dt_EditResult = new dsCommon.dtResultDataTable(); string strType = m_request.Tables[0].Rows[0]["Type"].ToString(); string strSystem = m_request.Tables[0].Rows[0]["System"].ToString(); string strReceiver = m_request.Tables[0].Rows[0]["Receiver"].ToString(); string strSender = m_request.Tables[0].Rows[0]["Sender"].ToString(); string Content = m_request.Tables[0].Rows[0]["Content"].ToString(); string SendTime = m_request.Tables[0].Rows[0]["SendTime"].ToString(); string strResult = AMSendMsg.Send(strType, strSystem, strReceiver, strSender, Content, SendTime); if (strResult == "0") { dt_EditResult.Rows.Add(new object[] { false, "发送成功!" }); } else { dt_EditResult.Rows.Add(new object[] { false, "发送失败!" }); } ds_Return.Tables.Add(dt_EditResult); return ds_Return; }
public DataSet GetData() { Dbconn conn = new Dbconn("WSRR"); string strXML = m_request.Tables[0].Rows[0]["XML"].ToString(); DataTable dt_EditResult = new dsCommon.dtResultDataTable(); DataSet dsRequest = new DataSet(); DataSet ds_Return = new DataSet(); dsRequest = Common.Common.GetDSByExcelXML(strXML); DataTable dt_OPTYPE = dsRequest.Tables["OPTYPE"]; DataTable dt_LIST = dsRequest.Tables["LIST"]; for (int i = 0; i < dt_OPTYPE.Rows.Count; i++) { //获取用户权限信息 if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "GET") { string strUserName = dt_LIST.Rows[0]["UserName"].ToString(); string strSQL = @" SELECT DISTINCT T1.[AUZID] ,T1.[AUZName] ,0 AS Authorization_ID_F , CASE WHEN T2.USERNAME IS NULL THEN '0' ELSE '1' END HavaFlag FROM [WSRR_Manage].[F01_CERT].[AUZ] T1 WITH ( NOLOCK ) LEFT JOIN [WSRR_Manage].[F01_CERT].[UserAUZ] T2 WITH ( NOLOCK ) ON T1.AUZID=T2.AUZID AND T2.USERNAME=@param0"; ds_Return = conn.GetDataSet(strSQL, new string[] { strUserName }); } //更新用户权限 else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "UPDATE") { string strUserName = dt_LIST.Rows[0]["UserName"].ToString(); conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[UserAUZ]");//锁定表 conn.BeginTransaction(); //1.删除该用户的所有权限 string strWhere = " UserName="******"[WSRR_Manage].[F01_CERT].[UserAUZ]", strWhere); //2.新增勾选的权限 bool insertFlag = conn.Insert("[WSRR_Manage].[F01_CERT].[UserAUZ]", dt_LIST); conn.CommitTransaction(); //删除操作和插入操作都正确的情况下 if (deleteFlag && insertFlag) { dt_EditResult.Rows.Add(new object[] { true, strUserName + "权限更新成功!" }); } else { dt_EditResult.Rows.Add(new object[] { true, strUserName + "权限更新失败!" }); } ds_Return.Tables.Add(dt_EditResult); } } return ds_Return; }
public DataSet GetData() { Dbconn conn = new Dbconn("WSRR"); string strWhere = string.Empty; string strXML = m_request.Tables[0].Rows[0]["XML"].ToString(); DataTable dt_EditResult = new dsCommon.dtResultDataTable(); DataSet dsRequest = new DataSet(); DataSet ds_Return = new DataSet(); dsRequest = Common.Common.GetDSByExcelXML(strXML); DataTable dt_OPTYPE = dsRequest.Tables["OPTYPE"]; DataTable dt_LIST = dsRequest.Tables["LIST"]; for (int i = 0; i < dt_OPTYPE.Rows.Count; i++) { //获取权限信息 if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "GET") { string strSQL = @" SELECT [AUZID] ,[AUZName] FROM [WSRR_Manage].[F01_CERT].[AUZ]"; ds_Return = conn.GetDataSetForPageList(strSQL,m_hzyPageInfo); } //新增环境的权限名称 else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "INSERT") { //String Env_ID = dt_LIST.Rows[0]["Env_ID"].ToString(); String strAuzName = dt_LIST.Rows[0]["AuzName"].ToString(); string strsql = @" SELECT COUNT(1) AS Cnt FROM [WSRR_Manage].[F01_CERT].[AUZ] WHERE Authorization_Name='" + strAuzName + "'"; DataTable dt = conn.GetDataTable(strsql); if (int.Parse(dt.Rows[0][0].ToString()) > 0) { dt_EditResult.Rows.Add(new object[] { false, "权限:" + strAuzName + "已存在!" }); } else { //dt_LIST.Rows[0]["AuzID"] = Guid.NewGuid().ToString(); conn.BeginTransaction(); bool flag = conn.Insert(" [WSRR_Manage].[F01_CERT].[AUZ]", dt_LIST); conn.CommitTransaction(); if (flag) { dt_EditResult.Rows.Add(new object[] { true, "权限:" + strAuzName + "添加成功!" }); } else { dt_EditResult.Rows.Add(new object[] { true, "权限:" + strAuzName + "添加失败!" }); } } ds_Return.Tables.Add(dt_EditResult); } //修改权限的菜单树 else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "EDIT") { String strAuZID = dt_LIST.Rows[0]["AuzID"].ToString(); strWhere = " AuzID=" + strAuZID; dt_LIST.Columns.Remove("AuzID");//移除属性,标识符列(ID)不能更新 conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[AUZ]"); conn.BeginTransaction(); bool flag = conn.Update("[WSRR_Manage].[F01_CERT].[AUZ]", dt_LIST, strWhere); conn.CommitTransaction(); if (flag) { dt_EditResult.Rows.Add(new object[] { true, "权限修改成功!" }); } else { dt_EditResult.Rows.Add(new object[] { false, "权限修改失败!" }); } ds_Return.Tables.Add(dt_EditResult); } //删除权限 else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "DELETE") { String strAuZID = dt_LIST.Rows[0]["AuzID"].ToString(); strWhere = " AuzID=" + strAuZID; conn.BeginTransaction(); bool flag = conn.Delete("[WSRR_Manage].[F01_CERT].[AUZ]", strWhere); conn.CommitTransaction(); if (flag) { dt_EditResult.Rows.Add(new object[] { true, "权限删除成功!" }); } else { dt_EditResult.Rows.Add(new object[] { false, "权限删除失败!" }); } ds_Return.Tables.Add(dt_EditResult); } } return ds_Return; }
/// <summary> /// VEX框架的主入口 /// </summary> /// <returns></returns> public DataSet GetData() { try { DataTable dtEditResult = new dsCommon.dtResultDataTable(); DataSet dsReturn = new DataSet(); DataSet dsRequest = Common.Common.GetDSByExcelXML(m_request.Tables[0].Rows[0]["XML"].ToString()); DataTable dtOptype = dsRequest.Tables["OPTYPE"]; for (int i = 0; i < dtOptype.Rows.Count; i++) { //验证 if (dsRequest.Tables[i + 1].Columns.Count > 0) { if (dsRequest.Tables[i + 1].Rows.Count == 0) { throw new Exception("参数不正确!"); } } if (dtOptype.Rows[0][0].ToString().ToUpper() == "GET") { dsReturn = GetList(dsRequest.Tables[i + 1]); } else if (dtOptype.Rows[0][0].ToString().ToUpper() == "GETALL") { dsReturn = GetAllList(dsRequest.Tables[i + 1]); } else if (dtOptype.Rows[i][0].ToString().ToUpper() == "EDIT") { //编辑操作 bool bResult = Save(dsRequest.Tables[i + 1]); if (bResult) { dtEditResult.Rows.Add(true, "修改成功"); } else { dtEditResult.Rows.Add(false, "修改失败"); } dsReturn.Tables.Add(dtEditResult); } else if (dtOptype.Rows[i][0].ToString().ToUpper() == "DELETE") { //删除操作 bool bResult = Delete(dsRequest.Tables[i + 1]); if (bResult) { dtEditResult.Rows.Add(true, "删除成功"); } else { dtEditResult.Rows.Add(false, "删除失败"); } dsReturn.Tables.Add(dtEditResult); } else { dtEditResult.Rows.Add(false, "操作失败"); dsReturn.Tables.Add(dtEditResult); } } return dsReturn; } catch { conn.RollbackTransaction(); throw; } }
public DataSet GetData() { try { Dbconn conn = new Dbconn("MDM"); //创建连接类 DataSet ds = new DataSet(); DataSet ds_Return = new DataSet(); DataTable dt_EditResult = new dsCommon.dtResultDataTable(); string strXML = string.Empty; strXML = m_request.Tables[0].Rows[0]["XML"].ToString(); //获取参数XML ds = Common.Common.GetDSByExcelXML(strXML); //转换XML到DataSet DataTable dt_OPTYPE = ds.Tables["OPTYPE"]; for (int i = 0; i < dt_OPTYPE.Rows.Count; i++) { if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "GET") { //获取List操作 m_request.Tables[0].TableName = "Page_Info"; m_request.Tables[0].Columns.Remove("XML"); //删除参数列XML WSServiceCall_GetList cls = new WSServiceCall_GetList(); cls.hzyMessage = this.hzyMessage; cls.Request = m_request; ds_Return = cls.GetData(); //调用WSServiceCall_GetList } else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "EDIT") { //编辑操作 DataSet ds1 = new DataSet(); ds1.Tables.Add(ds.Tables["list"].Copy()); //将XML获取的数据放入ds1 WSServiceCall_Edit cls = new WSServiceCall_Edit(); cls.hzyMessage = this.hzyMessage; //session信息传递 cls.Request = ds1; //传递参数 bool bResult = cls.Execute(); //调用WSServiceCall_Edit if (bResult) { dt_EditResult.Rows.Add(new object[] { true, "修改成功" }); } else { dt_EditResult.Rows.Add(new object[] { false, "修改失败" }); } ds_Return.Tables.Add(dt_EditResult); } else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "DELETE") { //删除操作 DataSet ds1 = new DataSet(); ds1.Tables.Add(ds.Tables["list"].Copy()); //将XML获取的数据放入ds1 WSServiceCall_Delete cls = new WSServiceCall_Delete(); cls.hzyMessage = this.hzyMessage; //session信息传递 cls.Request = ds1;//传递参数 bool bResult = cls.Execute(); //调用WSServiceCall_Delete if (bResult) { dt_EditResult.Rows.Add(new object[] { true, "删除成功" }); } else { dt_EditResult.Rows.Add(new object[] { false, "删除失败" }); } ds_Return.Tables.Add(dt_EditResult); } else { dt_EditResult.Rows.Add(new object[] { false, "修改失败" }); ds_Return.Tables.Add(dt_EditResult); } } return ds_Return; } catch (Exception) { throw; } }
public DataSet GetData() { Dbconn conn = new Dbconn("WSRR"); string strXML = m_request.Tables[0].Rows[0]["XML"].ToString(); DataTable dt_EditResult = new dsCommon.dtResultDataTable(); DataSet dsRequest = new DataSet(); DataSet ds_Return = new DataSet(); dsRequest = Common.Common.GetDSByExcelXML(strXML); DataTable dt_OPTYPE = dsRequest.Tables["OPTYPE"]; DataTable dt_LIST = dsRequest.Tables["LIST"]; for (int i = 0; i < dt_OPTYPE.Rows.Count; i++) { //获取用户权限信息 if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "GET") { string strSQL = @" SELECT [MenuID] ,[MenuName] ,[MenuFatherID] ,[ActionURL] FROM [WSRR_Manage].[F01_CERT].[Menu] "; ds_Return = conn.GetDataSet(strSQL); //ds_Return.Tables[0].Rows.Add(new object[] { "0", "00_根目录", "-1", "-1" }); } //更新 else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "EDIT") { string strMenuID = dt_LIST.Rows[0]["MenuID"].ToString(); bool bResult = false; conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[Menu]");//锁定表 conn.BeginTransaction();//开始事务 dt_LIST.Columns.Remove("MenuID");//移除属性,标识符列(ID)不能更新 bResult = conn.Update("[WSRR_Manage].[F01_CERT].[Menu]", dt_LIST, "MenuID=" + strMenuID);//update语句 conn.CommitTransaction(); if (bResult) { dt_EditResult.Rows.Add(new object[] { true, "修改成功" }); } else { dt_EditResult.Rows.Add(new object[] { false, "修改失败" }); } ds_Return.Tables.Add(dt_EditResult); } else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "INSERT") { string strMenuID = dt_LIST.Rows[0]["MenuID"].ToString(); bool bResult = false; conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[Menu]");//锁定表 conn.BeginTransaction();//开始事务 dt_LIST.Columns.Remove("MenuID");//移除属性,标识符列(ID)不能更新 bResult = conn.Insert("[WSRR_Manage].[F01_CERT].[Menu]", dt_LIST);//update语句 conn.CommitTransaction(); if (bResult) { dt_EditResult.Rows.Add(new object[] { true, "修改成功" }); } else { dt_EditResult.Rows.Add(new object[] { false, "修改失败" }); } ds_Return.Tables.Add(dt_EditResult); } else if (dt_OPTYPE.Rows[i][0].ToString().ToUpper() == "DELETE") { string strMenuID = dt_LIST.Rows[0]["MenuID"].ToString(); bool bResult = false; conn.LockTableList.Add("[WSRR_Manage].[F01_CERT].[Menu]");//锁定表 conn.BeginTransaction();//开始事务 dt_LIST.Columns.Remove("MenuID");//移除属性,标识符列(ID)不能更新 bResult = conn.Delete("[WSRR_Manage].[F01_CERT].[Menu]" , "MenuID=" + strMenuID);//update语句 conn.CommitTransaction(); if (bResult) { dt_EditResult.Rows.Add(new object[] { true, "修改成功" }); } else { dt_EditResult.Rows.Add(new object[] { false, "修改失败" }); } ds_Return.Tables.Add(dt_EditResult); } } return ds_Return; }