Beispiel #1
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public ReturnResult DeleteRole(string F_ROLECODE)
        {
            ReturnResult  result   = new ReturnResult();
            StringBuilder strSql   = new StringBuilder();
            DbAPI         dbHelper = new DbAPI();

            try
            {
                dbHelper.OpenConn("");
                dbHelper.OpenTrans();
                strSql.Append("delete from ROLEINFO ");
                strSql.Append(" where F_ROLECODE=:F_ROLECODE ");
                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_ROLECODE", dbHelper.CheckDBNull(F_ROLECODE))
                };

                int rows = dbHelper.ExecuteNonQuery(strSql.ToString(), parameters);
                if (rows > 0)
                {
                    strSql.Clear();
                    strSql.Append("delete from ROLEFUNCTION ");
                    strSql.Append(" where F_ROLECODE=:F_ROLECODE ");
                    OracleParameter[] parameters1 =
                    {
                        new OracleParameter(":F_ROLECODE", dbHelper.CheckDBNull(F_ROLECODE))
                    };

                    int rows1 = dbHelper.ExecuteNonQuery(strSql.ToString(), parameters1);
                    if (rows1 <= 0)
                    {
                        goto Over;
                    }
                    result.success = true;
                    result.Message = "操作成功";
                    dbHelper.CommitTrans();
                    dbHelper.CloseConn();
                    return(result);
                }
                else
                {
                    goto Over;
                }
            }
            catch (Exception ex)
            {
                LogBN.WriteLog(typeof(ROLEINFO_BN), "DeleteRole 程序段的异常" + ex);
                goto Over;
            }
Over:
            result.success = false;
            result.Message = "操作失败";
            dbHelper.RollBack();
            dbHelper.CloseConn();
            return(result);
        }
Beispiel #2
0
        public string SearchEqipment(DEVICEATTACH model)
        {
            StringBuilder strSql   = new StringBuilder();
            DbAPI         dbHelper = new DbAPI();

            OracleParameter[] parameters = null;
            strSql.Append("select * ");
            strSql.Append(" FROM DEVICEFULL WHERE 1=1 ");
            if (model.SEAAREA != "全部")
            {
                strSql.Append(" AND SEAAREA = '" + model.SEAAREA + "'");
            }
            if (model.PROVINCE != "全部")
            {
                strSql.Append(" AND PROVINCE LIKE '%" + dbHelper.CheckDBNull(model.PROVINCE).ToString() + "%'");
            }
            if (model.BAY != "全部")
            {
                strSql.Append(" AND BAY = '" + model.BAY + "'");
            }
            if (model.BUREAUDEVICE != "全部")
            {
                strSql.Append(" AND BUREAUDEVICE ='" + model.BUREAUDEVICE + "'");
            }
            if (model.LOCALDEVICE != "全部")
            {
                strSql.Append(" AND LOCALDEVICE = '" + model.LOCALDEVICE + "'");
            }
            if (model.SERVICE != "全部")
            {
                strSql.Append(" AND SERVICE = '" + model.SERVICE + "'");
            }

            try
            {
                dbHelper.OpenConn("");
                DataTable dt = new DataTable();
                dt = dbHelper.GetDataTable(strSql.ToString(), parameters);
                dbHelper.CloseConn();
                string result = JsonConvert.SerializeObject(dt, new DataTableConverter());
                return(result);
            }
            catch (Exception ex)
            {
                LogBN.WriteLog(typeof(DEVICEATTACH_BN), "SearchEqipment 程序段的异常" + ex);
                return("");
            }
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public ReturnResult AddRole(ROLEINFO model, string[] rolefunlist)
        {
            ReturnResult  result   = new ReturnResult();
            StringBuilder strSql   = new StringBuilder();
            DbAPI         dbHelper = new DbAPI();

            try
            {
                dbHelper.OpenConn("");
                dbHelper.OpenTrans();
                model.F_ROLECODE = dbHelper.GUID();
                strSql.Append("insert into ROLEINFO(");
                strSql.Append("F_ROLECODE,F_NAME,F_DESCRIPTION");
                strSql.Append(") values (");
                strSql.Append(":F_ROLECODE,:F_NAME,:F_DESCRIPTION");
                strSql.Append(") ");

                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_ROLECODE",    dbHelper.CheckDBNull(model.F_ROLECODE)),
                    new OracleParameter(":F_NAME",        dbHelper.CheckDBNull(model.F_NAME)),
                    new OracleParameter(":F_DESCRIPTION", dbHelper.CheckDBNull(model.F_DESCRIPTION))
                };

                int rows = dbHelper.ExecuteNonQuery(strSql.ToString(), parameters);
                if (rows > 0)
                {
                    for (int i = 0; i < rolefunlist.Length; i++)
                    {
                        strSql.Clear();
                        strSql.Append("insert into ROLEFUNCTION(");
                        strSql.Append("F_ID,F_ROLECODE,F_FUNCTIONCODE");
                        strSql.Append(") values (");
                        strSql.Append(":F_ID,:F_ROLECODE,:F_FUNCTIONCODE");
                        strSql.Append(") ");

                        OracleParameter[] parameters1 =
                        {
                            new OracleParameter(":F_ID",           dbHelper.CheckDBNull(dbHelper.GUID())),
                            new OracleParameter(":F_ROLECODE",     dbHelper.CheckDBNull(model.F_ROLECODE)),
                            new OracleParameter(":F_FUNCTIONCODE", dbHelper.CheckDBNull(rolefunlist[i]))
                        };

                        int rows1 = dbHelper.ExecuteNonQuery(strSql.ToString(), parameters1);
                        if (rows1 <= 0)
                        {
                            goto Over;
                        }
                    }
                    result.success = true;
                    result.Message = "操作成功";
                    dbHelper.CommitTrans();
                    dbHelper.CloseConn();
                    return(result);
                }
                else
                {
                    goto Over;
                }
            }
            catch (Exception ex)
            {
                LogBN.WriteLog(typeof(ROLEINFO_BN), "SaveRole 程序段的异常" + ex);
                goto Over;
            }
Over:
            result.success = false;
            result.Message = "操作失败";
            dbHelper.RollBack();
            dbHelper.CloseConn();
            return(result);
        }