Esempio n. 1
0
        /// <summary>
        /// 增、改K_SysModuleNode表

        /// </summary>
        /// <param Name="tranType">操作类型,NEW=增,EDIT=改</param>
        /// <param Name="paramsModel"></param>
        /// <returns>返回大于0的数字操作正常,返回非数字表示操作错误,返回的是系统错误说明</returns>
        public string Save(string tranType, KingTop.Model.SysManage.Module paramsModel)
        {
            string isOk = "";

            try
            {
                SqlParameter returnValue = new SqlParameter("@ReturnValue", SqlDbType.Int, 4);
                returnValue.Direction = ParameterDirection.Output;

                string cmdText = "proc_K_SysModuleSave";

                SqlParameter[] paras = new SqlParameter[] {
                    new SqlParameter("tranType", tranType),
                    new SqlParameter("ModuleID", paramsModel.ModuleID),
                    new SqlParameter("ModuleCode", paramsModel.ModuleCode),
                    new SqlParameter("ModuleName", paramsModel.ModuleName),
                    new SqlParameter("LinkURL", paramsModel.LinkURL),
                    new SqlParameter("IsValid", paramsModel.IsValid),
                    new SqlParameter("ModuleOrder", paramsModel.ModuleOrder),
                    new SqlParameter("ModuleDesc", paramsModel.ModuleDesc),
                    new SqlParameter("ModuleEncDesc", paramsModel.ModuleEncDesc),
                    new SqlParameter("IsSystem", paramsModel.IsSystem),
                    new SqlParameter("ModuleType", paramsModel.ModuleType),
                    new SqlParameter("TableName", paramsModel.TableName),
                    returnValue
                };

                SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, cmdText, paras);
                isOk = returnValue.Value.ToString();
            }
            catch (Exception ex)
            {
                isOk = ex.Message;
            }

            return(isOk);
        }
Esempio n. 2
0
        /// <summary>
        /// 增、改K_SysModule表

        /// </summary>
        /// <param name="tranType">操作类型,NEW=增,EDIT=改</param>
        /// <param name="AutModel"></param>
        /// <returns>返回大于0的数字操作正常,返回非数字表示操作错误,返回的是系统错误说明</returns>
        public string Save(string trantype, KingTop.Model.SysManage.Module ModuleModel)
        {
            return(dal.Save(trantype, ModuleModel));
        }
        protected bool SetNewAction(KingTop.Model.SysManage.Module mode)
        {
            bool   result       = false;
            string returnMsg2   = "";
            string OperCodeInfo = GetCheckResout();

            OperCodeInfo = OperCodeInfo.Replace(" ", "");
            string[] strOperCode = OperCodeInfo.Split(',');
            string   newOperCode = string.Empty;

            for (int i = 0; i < strOperCode.Length; i++)
            {
                if (string.IsNullOrEmpty(strOperCode[i]))
                {
                    continue;
                }

                if (string.IsNullOrEmpty(newOperCode))
                {
                    newOperCode = strOperCode[i].Split('|')[0];
                }
                else
                {
                    newOperCode += "," + strOperCode[i].Split('|')[0];
                }
            }

            if (!string.IsNullOrEmpty(OperCodeInfo))
            {
                //先删除以前选择的操作
                if (Action == "EDIT")
                {
                    //删除旧的操作,现在又去掉了
                    string[] arrAct         = hidoldOperCode.Value.Split(',');
                    string   newOperCode1   = "," + newOperCode + ",";
                    string   deleteOperCode = string.Empty;;
                    for (int i = 0; i < arrAct.Length; i++)
                    {
                        if (string.IsNullOrEmpty(arrAct[i].Trim()))
                        {
                            continue;
                        }

                        if (newOperCode1.IndexOf("," + arrAct[i].Trim() + ",") == -1)
                        {
                            if (string.IsNullOrEmpty(deleteOperCode))
                            {
                                deleteOperCode = arrAct[i].Trim();
                            }
                            else
                            {
                                deleteOperCode += "," + arrAct[i].Trim();
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(deleteOperCode))
                    {
                        string s = "DELETE FROM K_SysAccountPermit WHERE PermitCode in (SELECT ID FROM K_SysActionPermit WHERE ModuleID='" + mode.ModuleID + "' and OperEngDesc IN ('" + deleteOperCode.Replace(",", "','") + "'));";
                        s += "DELETE FROM K_SysRolePermit WHERE PermitCode in (SELECT ID FROM K_SysActionPermit WHERE ModuleID='" + mode.ModuleID + "' and OperEngDesc IN ('" + deleteOperCode.Replace(",", "','") + "'));";
                        s += "DELETE FROM K_SysUserGroupPermit WHERE PermitCode in (SELECT ID FROM K_SysActionPermit WHERE ModuleID='" + mode.ModuleID + "' and OperEngDesc IN ('" + deleteOperCode.Replace(",", "','") + "'));";
                        s += "DELETE FROM K_SysActionPermit WHERE ModuleID='" + mode.ModuleID + "' and OperEngDesc IN ('" + deleteOperCode.Replace(",", "','") + "')";
                        BllAction.ActionPermitSet("MODULEDEL", "", s);
                    }
                }
                string   insertOperCode = string.Empty;
                string[] arrAct2        = newOperCode.Split(',');
                string   oldOperCode    = "," + hidoldOperCode.Value + ",";
                for (int i = 0; i < arrAct2.Length; i++)
                {
                    if (string.IsNullOrEmpty(arrAct2[i].Trim()))
                    {
                        continue;
                    }

                    if (oldOperCode.IndexOf("," + arrAct2[i].Trim() + ",") == -1)
                    {
                        if (string.IsNullOrEmpty(insertOperCode))
                        {
                            insertOperCode = arrAct2[i].Trim();
                        }
                        else
                        {
                            insertOperCode += "," + arrAct2[i].Trim();
                        }
                    }
                }

                if (string.IsNullOrEmpty(insertOperCode))
                {
                    return(true);
                }
                string[] arrInsertOperCode = insertOperCode.Split(',');
                for (int i = 0; i < arrInsertOperCode.Length; i++)
                {
                    Actionmode.ID       = Guid.NewGuid();
                    Actionmode.ModuleID = mode.ModuleID;
                    //operCode
                    DataTable dt = BllAction.GetList("MAXCODE", Utils.getOneParams(mode.ModuleID.ToString()));
                    if (dt.Rows[0]["opercode"].ToString() != "")
                    {
                        Actionmode.operCode = dt.Rows[0]["opercode"].ToString();
                    }
                    else
                    {
                        Actionmode.operCode = mode.ModuleCode + "001";
                    }
                    //待修改
                    string operName = string.Empty;
                    for (int j = 0; j < strOperCode.Length; j++)
                    {
                        if (strOperCode[j].ToString().Split('|')[0].Trim() == arrInsertOperCode[i])
                        {
                            operName = strOperCode[j].ToString().Split('|')[1];
                            break;
                        }
                    }
                    Actionmode.OperName      = operName;
                    Actionmode.OperOrder     = "0";
                    Actionmode.IsValid       = true;
                    Actionmode.OperDesc      = Actionmode.OperName;
                    Actionmode.OperEngDesc   = arrInsertOperCode[i];
                    Actionmode.IsDefaultOper = false;
                    Actionmode.IsSystem      = false;
                    returnMsg2 = BllAction.Save("NEW", Actionmode);
                    try
                    {
                        if (Convert.ToInt32(returnMsg2) > 0)
                        {
                            result = true;
                        }
                    }
                    catch
                    {
                        result = false;
                    }
                }
            }
            return(result);
        }