コード例 #1
0
        /// <summary>
        /// グリッド設定を更新(Delete-Insert)
        /// </summary>
        /// <param name="dt"></param>
        public void UpdateGridConfigInfo(DataTable dt, string loginId)
        {
            SQLDBUtil db = new SQLDBUtil(_logger);

            SetNewDispOrder(dt);

            lock (_lockObj) {
                try {
                    db.Open(_connectString);
                    db.BeginTransaction();

                    //Delete
                    DataRow             r        = dt.Rows[0];
                    List <SqlParameter> delParam = new List <SqlParameter>();
                    delParam.Add(new SqlParameter("@window_name", r[CommonConsts.window_name]));
                    delParam.Add(new SqlParameter("@grid_name", r[CommonConsts.grid_name]));
                    delParam.Add(new SqlParameter("@login_id", loginId));
                    db.ExecuteNonQuery(SQLSrc.t_grid_config.DELETE, delParam.ToArray());

                    //Insert
                    foreach (DataRow dr in dt.Rows)
                    {
                        List <SqlParameter> insParam = new List <SqlParameter>();
                        insParam.Add(new SqlParameter("@window_name", dr[CommonConsts.window_name]));
                        insParam.Add(new SqlParameter("@grid_name", dr[CommonConsts.grid_name]));
                        insParam.Add(new SqlParameter("@db_name", dr[CommonConsts.db_name]));
                        insParam.Add(new SqlParameter("@login_id", loginId));
                        insParam.Add(new SqlParameter("@width", dr[CommonConsts.width]));
                        insParam.Add(new SqlParameter("@height", dr[CommonConsts.height]));
                        insParam.Add(new SqlParameter("@conf_editable", dr[CommonConsts.conf_editable]));
                        insParam.Add(new SqlParameter("@visible", dr[CommonConsts.visible]));
                        insParam.Add(new SqlParameter("@editable", dr[CommonConsts.editable]));
                        insParam.Add(new SqlParameter("@disp_order", dr[CommonConsts.disp_order]));
                        insParam.Add(new SqlParameter("@col_fixed", dr[CommonConsts.col_fixed]));
                        insParam.Add(new SqlParameter("@data_type", dr[CommonConsts.data_type]));
                        insParam.Add(new SqlParameter("@max_length", dr[CommonConsts.max_length]));
                        insParam.Add(new SqlParameter("@required", dr[CommonConsts.required]));
                        insParam.Add(new SqlParameter("@primary_key", dr[CommonConsts.primary_key]));
                        insParam.Add(new SqlParameter("@password_char", dr[CommonConsts.password_char]));
                        insParam.Add(new SqlParameter("@note", dr[CommonConsts.note]));

                        db.ExecuteNonQuery(SQLSrc.t_grid_config.INSERT, insParam.ToArray());
                    }

                    db.Commit();
                } catch (Exception) {
                    db.Rollback();
                    throw;
                } finally {
                    db.Close();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 検索条件初期設定を更新(Delete-Insert)
        /// </summary>
        /// <param name="dt"></param>
        public void UpdateSearchConditionInfo(DataTable dt, string loginId)
        {
            SQLDBUtil db = new SQLDBUtil(_logger);

            SetNewDispOrder(dt);

            lock (_lockObj) {
                try {
                    db.Open(_connectString);
                    db.BeginTransaction();

                    //Delete
                    DataRow             r        = dt.Rows[0];
                    List <SqlParameter> delParam = new List <SqlParameter>();
                    delParam.Add(new SqlParameter("@window_name", r[CommonConsts.window_name]));
                    delParam.Add(new SqlParameter("@grid_name", r[CommonConsts.grid_name]));
                    delParam.Add(new SqlParameter("@login_id", loginId));
                    db.ExecuteNonQuery(SQLSrc.t_search_condition.DELETE, delParam.ToArray());

                    //Insert
                    foreach (DataRow dr in dt.Rows)
                    {
                        List <SqlParameter> insParam = new List <SqlParameter>();
                        insParam.Add(new SqlParameter("@window_name", dr[CommonConsts.window_name]));
                        insParam.Add(new SqlParameter("@grid_name", dr[CommonConsts.grid_name]));
                        insParam.Add(new SqlParameter("@db_name", dr[CommonConsts.db_name]));
                        insParam.Add(new SqlParameter("@login_id", loginId));
                        insParam.Add(new SqlParameter("@ctl_type", dr[CommonConsts.ctl_type]));
                        insParam.Add(new SqlParameter("@value1", dr[CommonConsts.value1]));
                        insParam.Add(new SqlParameter("@value2", dr[CommonConsts.value2]));
                        insParam.Add(new SqlParameter("@visible", dr[CommonConsts.visible]));
                        insParam.Add(new SqlParameter("@disp_order", dr[CommonConsts.disp_order]));

                        db.ExecuteNonQuery(SQLSrc.t_search_condition.INSERT, insParam.ToArray());
                    }

                    db.Commit();
                } catch (Exception) {
                    db.Rollback();
                    throw;
                } finally {
                    db.Close();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Window状態を更新(Delete-Insert)
        /// </summary>
        /// <param name="dt"></param>
        public void UpdateWindowStateInfo(DataTable dt, string loginId)
        {
            SQLDBUtil db = new SQLDBUtil(_logger);

            lock (_lockObj) {
                try {
                    db.Open(_connectString);
                    db.BeginTransaction();

                    DataRow r = dt.Rows[0];

                    foreach (DataRow dr in dt.Rows)
                    {
                        //Delete
                        List <SqlParameter> delParam = new List <SqlParameter>();
                        delParam.Add(new SqlParameter("@window_name", r[CommonConsts.window_name]));
                        delParam.Add(new SqlParameter("@control_name", dr[CommonConsts.control_name]));
                        delParam.Add(new SqlParameter("@login_id", loginId));
                        db.ExecuteNonQuery(SQLSrc.t_window_state.DELETE, delParam.ToArray());

                        //Insert
                        List <SqlParameter> insParam = new List <SqlParameter>();
                        insParam.Add(new SqlParameter("@window_name", dr[CommonConsts.window_name]));
                        insParam.Add(new SqlParameter("@control_name", dr[CommonConsts.control_name]));
                        insParam.Add(new SqlParameter("@login_id", loginId));
                        insParam.Add(new SqlParameter("@conf_value", dr[CommonConsts.conf_value]));

                        db.ExecuteNonQuery(SQLSrc.t_window_state.INSERT, insParam.ToArray());
                    }

                    db.Commit();
                } catch (Exception) {
                    db.Rollback();
                    throw;
                } finally {
                    db.Close();
                }
            }
        }