Example #1
0
 public static Dictionary<string, MethodHandler> GetMethos(DBAdapter.DBAdapterBase _dBAdapter)
 {
     if(!methodHandlers.ContainsKey(_dBAdapter))
     {
         methodHandlers.Add(_dBAdapter, new MethodAnalyze(_dBAdapter));
     }
     return methodHandlers[_dBAdapter].Methods();
 }
Example #2
0
 public MethodAnalyze(DBAdapter.DBAdapterBase _dBAdapter)
 {
     //var table = TypeCache.GetTable(typeof(T));
     dBAdapter = _dBAdapter;
     if (dBAdapter == null)
     {
         throw new Exception("dBAdapter尚未初始化");
     }
 }
        } // insertExampleRow

        /*- Read rows example ------------------------------------------------------------------------------------- */
        public void readRowsExample()
        {
            // Update text
            textBoxRead.Text = "readRowsExample()";

            // Database
            DBAdapter dbAdapter = new DBAdapter(dbType, dbPath, dbFile, dbHost, dbPort, dbUser, dbPassword, dbName);

            dbAdapter.open();


            // Read
            String query = "SELECT case_id, case_number, case_evidence_number FROM cases ORDER BY case_id DESC LIMIT 15 offset 0";

            if (dbType.Equals("postgresql"))
            {
                NpgsqlDataReader reader = dbAdapter.queryRowsPostgres(query);
                while (reader.Read())
                {
                    int    caseId             = reader.GetInt32(0);
                    String caseNumber         = reader.GetString(1);
                    String caseEvidenceNumber = reader.GetString(2);
                    textBoxRead.Text = textBoxRead.Text + "\n" + caseId + " | " + caseNumber + "|" + caseEvidenceNumber;
                }
                reader.Close();
            }
            else
            {
                SQLiteDataReader reader = dbAdapter.queryRowsSQLite(query);
                while (reader.Read())
                {
                    int    caseId             = reader.GetInt32(0);
                    String caseNumber         = reader.GetString(1);
                    String caseEvidenceNumber = reader.GetString(2);
                    textBoxRead.Text = textBoxRead.Text + "\n" + caseId + " | " + caseNumber + "|" + caseEvidenceNumber;
                }
                reader.Close();
            }

            // Database close
            dbAdapter.close();
        } // readRowsExample
        public SpellCategory(MainWindow window, DBAdapter adapter)
        {
            main         = window;
            this.adapter = adapter;

            try
            {
                ReadDBCFile <SpellCategory_DBC_Record>("DBC/SpellCategory.dbc");

                int boxIndex = 1;
                main.Category.Items.Add(0);
                SpellCategoryLookup t;
                t.ID            = 0;
                t.comboBoxIndex = 0;
                Lookups.Add(t);

                for (uint i = 0; i < Header.RecordCount; ++i)
                {
                    var  record = Body.RecordMaps[i];
                    uint id     = (uint)record["ID"];

                    SpellCategoryLookup temp;
                    temp.ID            = id;
                    temp.comboBoxIndex = boxIndex;
                    Lookups.Add(temp);
                    main.Category.Items.Add(id);

                    boxIndex++;
                }
                Reader.CleanStringsMap();
                // In this DBC we don't actually need to keep the DBC data now that
                // we have extracted the lookup tables. Nulling it out may help with
                // memory consumption.
                Reader = null;
                Body   = null;
            }
            catch (Exception ex)
            {
                window.HandleErrorMessage(ex.Message);
                return;
            }
        }
Example #5
0
        public ActionResult Index()
        {
            StoreInfo store = SessionAdapter.getInstance().GetCurrentStore(Request);

            try
            {
                if (store.StoreCode == null)
                {
                    throw new Exception("Storecode is null, we need storecode to continue");
                }
                this.users          = DBAdapter.getInstance().GetUsersByStoreCode(store.StoreCode);
                @ViewBag.users      = this.users;
                @ViewBag.storeCodes = this.storeCodes;
            }
            catch (Exception e)
            {
                return(this.RedirectToAction("ChooseStore", "Login"));
            }
            return(View());
        }
Example #6
0
        /// <summary>
        /// 検索ボタンを押下した際のチェック
        /// </summary>
        private void SearchInputChecks()
        {
             
            if (cmbCompany.SelectedIndex <= 0) // ←なぜ0「以下」
            {
                throw new InputException(GlobalDefine.ERROR_CODE[15].message, GlobalDefine.ERROR_CODE[15].code);
            }

            // シングルクォーテーションチェック
            InputCheck.IsSingleQuotation(this.textUser);

            // ユーザが居るか
            DBAdapter dba   = SingletonObject.GetDbAdapter();
            string    query = string.Format("SELECT * FROM USER_MASTER WHERE USER_NAME LIKE '%{0}%'", textUser.Text);

            if (!dba.FindRecord(query))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[14].message, GlobalDefine.ERROR_CODE[14].code, textUser);
            }
        }
            public override void OnActionExecuting(ActionExecutingContext filterContext)
            {
                var filterInfo = new FilterContextInfo(filterContext);
                var authority  = new DBAdapter().Authority;

                if (filterInfo.Parameters.Count != 1)
                {
                    throw new ApplicationException("Project guid access attribute detected wrong action parameters.");
                }
                var projectId = int.Parse(filterInfo.Parameters.Values.Single().ToString());

                if (!authority.IsAuthorized(projectId))
                {
                    /// todo 跳到 No Access
                }
                else
                {
                    base.OnActionExecuting(filterContext);
                }
            }
Example #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Show);
            lv = FindViewById <ListView>(Resource.Id.lstview);

            lst = new List <string>();
            DBAdapter db = new DBAdapter(this);

            db.openDb();
            ICursor c = db.show();

            while (c.MoveToNext())
            {
                lst.Add(c.GetInt(0) + " " + c.GetString(1));
            }
            ArrayAdapter adp = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, lst);

            lv.Adapter = adp;
        }
Example #9
0
        public static DataTable UpdateWarehouse(DataTable warehouseA1ShipRequestRecords, string a1ShipRequestStatus)
        {
            if (warehouseA1ShipRequestRecords.Rows.Count == 0)
            {
                throw new Exception("The A1ShipRequest table update failed because the submitted table contains no rows!");
            }

            foreach (DataRow warehouseA1ShipRequestRecord in warehouseA1ShipRequestRecords.Rows)
            {
                warehouseA1ShipRequestRecord["status"]     = a1ShipRequestStatus;
                warehouseA1ShipRequestRecord["threadName"] = string.Empty;
            }

            lock (databaseSyncObject)
                using (DBConnection warehouseDBConnection = WarehouseDatabaseConnectionAdapter.GetDatabaseConnection())
                    using (DBAdapter a1ShipRequestDBAdapter = new DBAdapter(A1ShipRequestTableSchemaQuery, warehouseDBConnection.SqlConnection))
                        a1ShipRequestDBAdapter.Update(warehouseA1ShipRequestRecords);

            return(warehouseA1ShipRequestRecords);
        }
Example #10
0
        public static List <Trip> search(Context context, string where, string[] whereargs, string orderby)
        {
            DBAdapter   db   = new DBAdapter(context);
            List <Trip> list = new List <Trip>();

            ICursor cursor = db.search("trip", new string[] { "*" }, where, whereargs, null, null, orderby);

            if (cursor == null)
            {
                return(null);
            }

            cursor.MoveToFirst();

            do
            {
                Trip t = new Trip();

                t.id                = cursor.GetLong(0);
                t.reward            = cursor.GetFloat(1);
                t.home              = cursor.GetString(1);
                t.destiny           = cursor.GetString(3);
                t.toll_value        = cursor.GetFloat(4);
                t.fuell_value       = cursor.GetFloat(5);
                t.freight           = cursor.GetString(6);
                t.registration_date = DateTime.Parse(cursor.GetString(7));
                t.lastedit_date     = DateTime.Parse(cursor.GetString(8));
                string tmp = cursor.GetString(9);
                if (tmp == "" || tmp == null)
                {
                    t.complete_date = null;
                }
                else
                {
                    t.complete_date = DateTime.Parse(tmp);
                }
                list.Add(t);
            } while (cursor.MoveToNext());

            return(list);
        }
        public OPERATION Get_Query()
        {
            SqlParameter[] param = new SqlParameter[2];
            Employee       emp   = new Employee("", "");

            string command = "SELECT * FROM Employee where Emp_ID=@name And Emp_code=@pass";

            try
            {
                DBAdapter.OPen();
                param[0]       = new SqlParameter("@name", SqlDbType.NVarChar, 50);
                param[0].Value = this.Name;

                param[1]       = new SqlParameter("@pass", SqlDbType.NVarChar, 50);
                param[1].Value = this.Code;
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
            DBAdapter.Close();

            DataTable table = _do.getQuery(command, param);

            if (table.Rows.Count > 0)
            {
                emp.Name   = table.Rows[0][0].ToString();
                emp.Code   = table.Rows[0][1].ToString();
                emp.Date   = table.Rows[0][2].ToString();
                emp.Time   = table.Rows[0][3].ToString();
                emp.power  = table.Rows[0][4].ToString();
                emp.Phone  = table.Rows[0][5].ToString();
                emp.Salary = table.Rows[0][6].ToString();

                return(emp);
            }
            else
            {
                return(null);
            }
        }
 public void CmdDeletePoint()
 {
     if (ValgtAktivitet.HoldSport == 0)
     {
         //HoldSport Delete HOLD score
         if (SelectedPoint != -1)
         {
             DBAdapter.deleteHoldScore(SelectedPoint);
             SelectedPoint = -1;
         }
     }
     else if (ValgtAktivitet.HoldSport == 1)
     {
         if (SelectedPoint != -1)
         {
             //HoldSport Deltete DELTAGER score
             DBAdapter.deleteDeltagerScore(SelectedPoint);
             SelectedPoint = -1;
         }
     }
 }
Example #13
0
 public void CmdSaveLogin()
 {
     if (TxtBrugernavn != "" && TxtKodeord != "" && TxtKodeord == TxtKodeordRepeat && SelectedAdminType <= CurrentLogin.AdminType)
     {
         if (SelectedAdminType == 0 && SelectedEvent != -1 && SelectedHold != -1 || SelectedAdminType > 0)
         {
             int?tempEventId = null;
             if (SelectedEvent != -1)
             {
                 tempEventId = SelectedEvent;
             }
             int?tempHoldId = null;
             if (SelectedHold != -1)
             {
                 tempHoldId = SelectedHold;
             }
             DBAdapter.addLogin(TxtBrugernavn, TxtKodeord, SelectedAdminType, tempEventId, tempHoldId);
             loadLoginList();
         }
     }
 }
Example #14
0
        /// <summary>
        /// ダイアログ初期化
        /// </summary>
        private void InitDialog()
        {
            DBAdapter dba = SingletonObject.GetDbAdapter();

            this.Text = GlobalDefine.FORM_NAME;

            this.dataTable = SingletonObject.GetMemberList();

            string query = "SELECT * FROM BOOK_GENRE_MASTER";

            cmbCategory1.DataSource = dba.execSQL(query);
            cmbCategory2.DataSource = dba.execSQL(query);
            cmbCategory3.DataSource = dba.execSQL(query);

            cmbCategory1.DisplayMember = "DIVISION_NAME";
            cmbCategory1.ValueMember   = "DIVISION_ID";
            cmbCategory2.DisplayMember = "DIVISION_NAME";
            cmbCategory2.ValueMember   = "DIVISION_ID";
            cmbCategory3.DisplayMember = "DIVISION_NAME";
            cmbCategory3.ValueMember   = "DIVISION_ID";
        }
Example #15
0
        public static bool is_blob_attr(RubyModule /*!*/ self, [NotNull] String /*!*/ strPartition, [NotNull] int /*!*/ nSrcID, [NotNull] String /*!*/ strAttrName)
        {
            bool res = false;

            try
            {
                res = DBAdapter.getDB(strPartition).getAttrMgr().isBlobAttr(nSrcID, strAttrName);
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("is_blob_attr", ex);
                throw rubyEx;
            }

            return(res);
        }
Example #16
0
        /// <summary>
        /// コントロール初期化
        /// </summary>
        public void InitControl()
        {
            // ドロップダウンリストに設定
            this.DropDownStyle = ComboBoxStyle.DropDownList;

            DBAdapter dba = SingletonObject.GetDbAdapter();

            string query = "SELECT * FROM BOOK_GENRE_MASTER";

            DataTable dt1 = dba.execSQL(query);
            DataRow   dr  = dt1.NewRow();

            dr["DIVISION_ID"]   = "";
            dr["DIVISION_NAME"] = "";
            dt1.Rows.InsertAt(dr, 0);

            this.DataSource = dt1;

            this.DisplayMember = GlobalDefine.CATEGORY_DISPLAY;
            this.ValueMember   = GlobalDefine.CATEGORY_VALUE;
        }
Example #17
0
        public OPERATION Get_Query()
        {
            SqlParameter[] param = new SqlParameter[2];

            Car car = new Car("", "");

            string command = " SELECT * FROM Car where ID=@id And char=@char ";

            try
            {
                DBAdapter.OPen();
                param[0]       = new SqlParameter("@id", SqlDbType.NVarChar, 50);
                param[0].Value = this.Car_ID;

                param[1]       = new SqlParameter("@char", SqlDbType.NVarChar, 50);
                param[1].Value = this.Car_Char;
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
            DBAdapter.Close();

            DataTable table = _do.getQuery(command, param);

            if (table.Rows.Count > 0)
            {
                car.Car_ID   = table.Rows[0][0].ToString();
                car.Car_Char = table.Rows[0][1].ToString();
                car.Date     = table.Rows[0][2].ToString();
                car.Time     = table.Rows[0][3].ToString();


                return(car);
            }
            else
            {
                return(null);
            }
        }
Example #18
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var filterInfo = new FilterContextInfo(filterContext);

            if (ChineseAbs.ABSManagement.Utils.CommUtils.IsLocalDeployed())
            {
                if (!System.Web.Security.Roles.IsUserInRole(filterInfo.Username,
                                                            ChineseAbs.ABSManagementSite.Controllers.ManageController.RoleAdmin))
                {
                    var routeValue = new RouteValueDictionary(new
                    {
                        controller = "Error",
                        action     = "NoAccess",
                    });
                    filterContext.Result = new RedirectToRouteResult(routeValue);
                }

                base.OnActionExecuting(filterContext);
            }
            else
            {
                var authority = new DBAdapter().Authority;
                var isAdmin   = authority.IsEnterpriseAdministrator(filterInfo.Username);
                if (isAdmin)
                {
                    base.OnActionExecuting(filterContext);
                }
                else
                {
                    var routeValue = new RouteValueDictionary(new
                    {
                        controller = "Error",
                        action     = "NoAccess",
                    });
                    filterContext.Result = new RedirectToRouteResult(routeValue);
                    base.OnActionExecuting(filterContext);
                }
            }
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var filterInfo = new FilterContextInfo(filterContext);
            var userInfo   = new UserInfo(filterInfo.Username);
            var authority  = new DBAdapter().Authority;

            bool isAuthorized = false;

            //有指定权限中的任何一种权限,即可通过该filter验证
            //AuthorityType.Undefined 表示任意权限
            var flags = CommUtils.GetEnumFlags(m_authorityType);

            foreach (var flag in flags)
            {
                if (authority.IsAuthorized((AuthorityType)flag))
                {
                    isAuthorized = true;
                    break;
                }
            }

            if (!isAuthorized)
            {
                string msg = "Check authority failed:" + (m_authorityType == AuthorityType.Undefined ?
                                                          "Design" : m_authorityType.ToString());

                var routeValue = new RouteValueDictionary(new
                {
                    controller = "Error",
                    action     = "NoAccess",
                    message    = msg
                });
                filterContext.Result = new RedirectToRouteResult(routeValue);
                base.OnActionExecuting(filterContext);
                return;
            }

            base.OnActionExecuting(filterContext);
        }
Example #20
0
        public SpellDuration(MainWindow window, DBAdapter adapter)
        {
            main         = window;
            this.adapter = adapter;

            try
            {
                ReadDBCFile <SpellDurationRecord>("DBC/SpellDuration.dbc");

                int boxIndex = 1;
                main.Duration.Items.Add(0);
                SpellDurationLookup t;
                t.ID            = 0;
                t.comboBoxIndex = 0;
                Lookups.Add(t);

                for (uint i = 0; i < Header.RecordCount; ++i)
                {
                    var record = Body.RecordMaps[i];

                    SpellDurationLookup temp;
                    temp.ID            = (uint)record["ID"];
                    temp.comboBoxIndex = boxIndex;
                    Lookups.Add(temp);

                    Label label = new Label();
                    label.Content = $"{ record["BaseDuration"] }ms BaseDuration, { record["PerLevel"] } BaseDuration, { record["MaximumDuration"] }ms MaximumDuration, { temp.ID } ID";
                    main.Duration.Items.Add(label);

                    ++boxIndex;
                }
                Reader.CleanStringsMap();
            }
            catch (Exception ex)
            {
                window.HandleErrorMessage(ex.Message);
                return;
            }
        }
Example #21
0
        /// <summary>
        /// 削除ボタン
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool valueEqual = ValueCompare();

            bool cancelSelected = valueEqual ? !base.AskMessageBox(GlobalDefine.MESSAGE_ASK_DELETE)
                                             : !base.AskMessageBox(GlobalDefine.MESSAGE_ASK_DELETE_CHANGE);

            if (cancelSelected)
            {
                return;
            }

            string    query = string.Format("UPDATE USER_MASTER SET RETIREMENT_FLAG=1 WHERE USER_ID='{0}'", textId.Text);
            DBAdapter dba   = SingletonObject.GetDbAdapter();

            dba.nonExecSQL(query);

            MessageBox.Show(GlobalDefine.MESSAGE_COMPLETE_DELETE);

            mode = MODE.DEL;
            this.Close();
        }
        public SpellIconDBC(MainWindow window, DBAdapter adapter)
        {
            main         = window;
            this.adapter = adapter;

            try
            {
                ReadDBCFile <Icon_DBC_Record>("DBC/SpellIcon.dbc");

                for (uint i = 0; i < Header.RecordCount; ++i)
                {
                    var  record = Body.RecordMaps[i];
                    uint offset = (uint)record["Name"];
                    if (offset == 0)
                    {
                        continue;
                    }
                    string name = Reader.LookupStringOffset(offset);
                    uint   id   = (uint)record["ID"];

                    Icon_DBC_Lookup lookup;
                    lookup.ID     = id;
                    lookup.Offset = offset;
                    lookup.Name   = name;
                    Lookups.Add(lookup);
                }
                Reader.CleanStringsMap();
                // In this DBC we don't actually need to keep the DBC data now that
                // we have extracted the lookup tables. Nulling it out may help with
                // memory consumption.
                Reader = null;
                Body   = null;
            }
            catch (Exception ex)
            {
                main.HandleErrorMessage(ex.Message);
                return;
            }
        }
 public void CmdAddPoint()
 {
     if (ValgtAktivitet.HoldSport == 0)
     {
         //HoldSport Add HOLD score
         if (TxtScore != null)
         {
             DBAdapter.addHoldScore(SelectedEvent, SelectedEventAktivitet, SelectedOrder, SelectedHold, TxtScore.Value);
             HoldList = DBAdapter.getHold(SelectedEvent, SelectedOrder, SelectedEventAktivitet);
             HoldList = DBAdapter.getHoldAktivitet(HoldList, SelectedEvent, SelectedOrder, SelectedEventAktivitet);
             HoldList = DBAdapter.getHoldAktivitetScores(HoldList, SelectedEvent, SelectedOrder, SelectedEventAktivitet);
         }
     }
     else if (ValgtAktivitet.HoldSport == 1)
     {
         if (TxtScore != null)
         {
             DBAdapter.addDeltagerScore(SelectedEvent, SelectedEventAktivitet, SelectedHold, SelectedDeltager, TxtScore.Value);
             DeltagerList = DBAdapter.getDeltagere(SelectedEvent, SelectedEventAktivitet, SelectedHold);
         }
         //HoldSport Add DELTAGER score
     }
 }
Example #24
0
        public IActionResult OnGet()
        {
            loadTempDataLogin();
            checkScript();

            if (ValgtGuiElemement == "cmdLogin")
            {
                if (TxtUsername != "" && TxtPassword != "")
                {
                    CurrentLogin = DBAdapter.verifyLogin(TxtUsername, TxtPassword);
                    if (CurrentLogin.Id != 0)
                    {
                        saveTempDataLogin();
                    }
                }
            }
            if (ValgtGuiElemement == "cmdLogud")
            {
                CurrentLogin = null;
                saveTempDataLogin();
            }
            return(this.Page());
        }
Example #25
0
        public IActionResult OnGet()
        {
            loadTempDataLogin();
            if (CurrentLogin != null)
            {
                CurrentLogin = DBAdapter.verifyLogin(CurrentLogin.Brugernavn, CurrentLogin.Kodeord);
            }
            if (CurrentLogin == null || CurrentLogin.Id == 0 || CurrentLogin.AdminType == 0)
            {
                return(Redirect("/Index"));
            }
            else
            {
                if (Request.Query.ContainsKey("Event"))
                {
                    SelectedEvent = int.Parse(Request.Query["Event"]);
                    DeltagerList  = DBAdapter.getDeltagere(SelectedEvent);
                    HoldList      = DBAdapter.getHold();
                }
                else
                {
                    if (TempData.Peek("SelectedEvent") != null)
                    {
                        TempData.Keep("SelectedEvent");
                        DeltagerList = DBAdapter.getDeltagere(SelectedEvent);
                        HoldList     = DBAdapter.getHold();
                    }
                    else
                    {
                        SelectedEvent = -1;
                    }
                }
                EventList = DBAdapter.getEvent();

                return(this.Page());
            }
        }
        public List <Employee> GetAll()
        {
            List <Employee> all = new List <Employee>();

            DataTable table;

            string command = "SELECT * FROM Employee ";

            try
            {
                DBAdapter.OPen();
            }
            catch (Exception ex)
            {
                Alert.Show(ex.Message);
            }
            DBAdapter.Close();

            table = _do.getQuery(command, null);

            for (int i = 0; i < table.Rows.Count; i++)
            {
                Employee emp = new Employee("", "");
                emp.Name   = table.Rows[i]["Emp_ID"].ToString();
                emp.Code   = table.Rows[i]["Emp_code"].ToString();
                emp.Date   = table.Rows[i]["Date"].ToString();
                emp.power  = table.Rows[i]["Power"].ToString();
                emp.Phone  = table.Rows[i]["Phone"].ToString();
                emp.Time   = table.Rows[i]["time"].ToString();
                emp.Salary = table.Rows[i]["Salary"].ToString();

                all.Add(emp);
            }


            return(all);
        }
Example #27
0
        // 入力チェック用メソッド
        private void ErrorCheck()
        {
            // シングルクォーテーションが入っていたら(会社名)
            if (this.textName.Text.IndexOf('\'') >= 0)
            {
                throw new InputException(GlobalDefine.ERROR_CODE[0].message, GlobalDefine.ERROR_CODE[0].code, this.textName);
            }

            // 空文字チェック(会社名)
            if (string.IsNullOrEmpty(this.textName.Text))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[1].message, GlobalDefine.ERROR_CODE[1].code, this.textName);
            }

            // 新規追加モードの場合、会社名が登録されているかどうか
            if (mode == MODE.ADD)
            {
                DBAdapter dba = SingletonObject.GetDbAdapter();
                string    str = string.Format("SELECT * FROM COMPANY_MASTER WHERE COMPANY_NAME = '{0}'", this.textName.Text);
                if (dba.FindRecord(str))
                {
                    throw new InputException(GlobalDefine.ERROR_CODE[3].message, GlobalDefine.ERROR_CODE[3].code, this.textName);
                }
            }

            // シングルクォーテーションが入っていたら(会社略称)
            if (this.textAbbreviation.Text.IndexOf('\'') >= 0)
            {
                throw new InputException(GlobalDefine.ERROR_CODE[1].message, GlobalDefine.ERROR_CODE[1].code, this.textAbbreviation);
            }

            // 空文字チェック(会社略称)
            if (string.IsNullOrEmpty(this.textAbbreviation.Text))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[2].message, GlobalDefine.ERROR_CODE[2].code, this.textAbbreviation);
            }
        }
Example #28
0
        public void Set_Query()
        {
            string command = "insert into Car (ID,char,date,time) values (@id,@char,@date,@time) ";

            try
            {
                DBAdapter.OPen();

                SqlParameter[] param = new SqlParameter[4];

                param[0]       = new SqlParameter("@id", SqlDbType.NVarChar, 50);
                param[0].Value = this.Car_ID;

                param[1]       = new SqlParameter("@char", SqlDbType.NVarChar, 50);
                param[1].Value = this.Car_Char;

                param[2]       = new SqlParameter("@date", SqlDbType.NVarChar, 50);
                param[2].Value = DateTime.Now.ToShortDateString();

                param[3]       = new SqlParameter("@time", SqlDbType.NVarChar, 50);
                param[3].Value = DateTime.Now.ToLongTimeString();

                _do.Execute_Query(command, param);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DBAdapter.Close();
            }


            //-------
        }
Example #29
0
        public void Reset_Query( )
        {
            string command = "Update Car set (ID=@id,char=@char,date=@date,time=@time) where ID=@id And char=@char  ";

            try
            {
                DBAdapter.OPen();

                SqlParameter[] param = new SqlParameter[4];

                param[0]       = new SqlParameter("@id", SqlDbType.NVarChar, 50);
                param[0].Value = this.Car_ID;

                param[1]       = new SqlParameter("@char", SqlDbType.NVarChar, 50);
                param[1].Value = this.Car_Char;

                param[2]       = new SqlParameter("@date", SqlDbType.NVarChar, 50);
                param[2].Value = this.Date;

                param[3]       = new SqlParameter("@time", SqlDbType.NVarChar, 50);
                param[3].Value = this.Time;



                _do.Execute_Query(command, param);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DBAdapter.Close();
                Alert.Show("Car Reset Successfuly");
            }
        }
Example #30
0
        private void loadHoldAktivitetList()
        {
            HoldAktivitetList = DBAdapter.getHold(SelectedEvent);
            HoldAktivitetList = DBAdapter.getHoldAktivitet(HoldAktivitetList, SelectedEvent);
            HoldAktivitetList = HoldAktivitetList.Where(i => i.HoldAktiviteter.Where(i => i.EventAktivitetId == SelectedEventAktivitet).FirstOrDefault() != null).ToList();
            foreach (var _hold in HoldAktivitetList)
            {
                _hold.HoldAktiviteter = _hold.HoldAktiviteter.Where(i => i.EventAktivitetId == SelectedEventAktivitet).ToList();
            }
            List <Hold> tempHoldList = new List <Hold>();

            foreach (var _hold in HoldAktivitetList)
            {
                foreach (var _aktivitet in _hold.HoldAktiviteter)
                {
                    Hold h = _hold;
                    h.HoldAktiviteter = new List <EventAktivitetHold>();
                    h.HoldAktiviteter.Add(_aktivitet);
                    tempHoldList.Add(h);
                }
            }
            tempHoldList      = tempHoldList.OrderBy(i => i.HoldAktiviteter[0].HoldOrder).ThenBy(i => i.Navn).ToList();
            HoldAktivitetList = tempHoldList;
        }
Example #31
0
 internal static void SetColumnDbType(DBAdapter.DBAdapterBase dbAdapter, Attribute.FieldAttribute info, Dictionary<Type, string> dic)
 {
     if (info.FieldType != Attribute.FieldType.数据库字段)
     {
         return ;
     }
     string defaultValue;
     Type propertyType = info.PropertyType;
     if (propertyType.FullName.IndexOf("System.") > -1 && !dic.ContainsKey(propertyType))
     {
         throw new Exception(string.Format("找不到对应的字段类型映射 {0} 在 {1}", propertyType, dbAdapter));
     }
     var columnType = dbAdapter.GetColumnType(info, out defaultValue);
     info.ColumnType = columnType;
     info.DefaultValue = defaultValue;
     if (info.ColumnType.Contains("{0}"))
     {
         throw new Exception(string.Format("属性:{0} 需要指定长度 ColumnType:{1}", info.Name, info.ColumnType));
     }
 }
Example #32
0
 public Car(string id, string character)
 {
     this.Car_ID   = id;
     this.Car_Char = character.ToString();
     _do           = new DBAdapter();
 }
Example #33
0
        // End DBCs

        public SpellFocusObject(MainWindow window, DBAdapter adapter)
        {
            this.main    = window;
            this.adapter = adapter;

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                body.records[i].ID    = new UInt32();
                body.records[i].Name  = new UInt32[16];
                body.records[i].Flags = new UInt32();
            }

            if (!File.Exists("DBC/SpellFocusObject.dbc"))
            {
                main.HandleErrorMessage("SpellFocusObject.dbc was not found!");

                return;
            }

            FileStream fileStream = new FileStream("DBC/SpellFocusObject.dbc", FileMode.Open);
            int        count      = Marshal.SizeOf(typeof(DBC_Header));

            byte[]       readBuffer = new byte[count];
            BinaryReader reader     = new BinaryReader(fileStream);

            readBuffer = reader.ReadBytes(count);
            GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);

            header = (DBC_Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DBC_Header));
            handle.Free();

            body.records = new SpellFocusObject_DBC_Record[header.RecordCount];

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                count           = Marshal.SizeOf(typeof(SpellFocusObject_DBC_Record));
                readBuffer      = new byte[count];
                reader          = new BinaryReader(fileStream);
                readBuffer      = reader.ReadBytes(count);
                handle          = GCHandle.Alloc(readBuffer, GCHandleType.Pinned);
                body.records[i] = (SpellFocusObject_DBC_Record)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SpellFocusObject_DBC_Record));
                handle.Free();
            }

            body.StringBlock = reader.ReadBytes(header.StringBlockSize);

            reader.Close();
            fileStream.Close();

            body.lookup = new List <SpellFocusObjectLookup>();

            int boxIndex = 1;

            main.RequiresSpellFocus.Items.Add("None");

            SpellFocusObjectLookup t;

            t.ID            = 0;
            t.offset        = 0;
            t.stringHash    = "None".GetHashCode();
            t.comboBoxIndex = 0;

            body.lookup.Add(t);

            for (UInt32 i = 0; i < header.RecordCount; ++i)
            {
                int offset = (int)body.records[i].Name[window.GetLanguage()];

                if (offset == 0)
                {
                    continue;
                }

                int returnValue = offset;

                System.Collections.ArrayList al = new System.Collections.ArrayList();

                while (body.StringBlock[offset] != '\0')
                {
                    al.Add(body.StringBlock[offset++]);
                }

                byte[] toAdd = new byte[al.Count];
                int    n     = 0;
                foreach (byte o in al)
                {
                    toAdd[n++] = o;
                }

                SpellFocusObjectLookup temp;

                temp.ID            = (int)body.records[i].ID;
                temp.offset        = returnValue;
                temp.stringHash    = Encoding.UTF8.GetString(toAdd).GetHashCode();
                temp.comboBoxIndex = boxIndex;

                main.RequiresSpellFocus.Items.Add(Encoding.UTF8.GetString(toAdd));

                body.lookup.Add(temp);

                boxIndex++;
            }
        }
Example #34
0
 /// <summary>
 /// 获取列
 /// </summary>
 /// <returns></returns>
 List<Attribute.FieldAttribute> GetColumns(DBAdapter.DBAdapterBase dbAdapter)
 {
     //var dbAdapter = Base.CurrentDBAdapter;
     Type type = this.GetType();
     string tableName = TypeCache.GetTableName(type,dbAdapter.dbContext);
     var typeArry = TypeCache.GetProperties(type, true).Values;
     var columns = new List<CRL.Attribute.FieldAttribute>();
     foreach (var info in typeArry)
     {
         if (info.FieldType == Attribute.FieldType.虚拟字段)
             continue;
         SetColumnDbType(dbAdapter, info);
         columns.Add(info);
     }
     return columns;
 }
Example #35
0
 internal static void SetColumnDbType(DBAdapter.DBAdapterBase dbAdapter, Attribute.FieldAttribute info)
 {
     if (info.FieldType != Attribute.FieldType.数据库字段)
     {
         return ;
     }
     string defaultValue;
     Type propertyType = info.PropertyType;
     var columnType = dbAdapter.GetColumnType(info, out defaultValue);
     info.ColumnType = columnType;
     info.DefaultValue = defaultValue;
     if (info.ColumnType.Contains("{0}"))
     {
         throw new Exception(string.Format("属性:{0} 需要指定长度 ColumnType:{1}", info.Name, info.ColumnType));
     }
 }