コード例 #1
0
        public Account_c(string acc, string pwd)
        {
            Lib.DataUtility du = new Lib.DataUtility();
            DataTable       dt = du.getDataTableByText("select * from account_c where account = @acc", "acc", acc);

            if (dt.Rows.Count != 1)
            {
                isValid     = false;
                loginstatus = LoginStatus.Logout;
            }
            if (dt.Rows.Count == 1)
            {
                if (dt.Rows[0]["password"].ToString() == pwd)
                {
                    isValid     = true;
                    account     = acc;
                    password    = pwd;
                    role_code   = dt.Rows[0]["role_code"].ToString();
                    name        = dt.Rows[0]["name"].ToString();
                    id          = dt.Rows[0]["id"].ToString();
                    unit_code   = dt.Rows[0]["unit_code"].ToString();
                    rank_code   = dt.Rows[0]["rank_code"].ToString();
                    tel         = dt.Rows[0]["tel"].ToString();
                    cell        = dt.Rows[0]["cellphone"].ToString();
                    mail        = dt.Rows[0]["mail"].ToString();
                    ip          = dt.Rows[0]["ip"].ToString();
                    pwdChange   = dt.Rows[0]["pwdChange"].ToString();
                    status      = dt.Rows[0]["status"].ToString();
                    byAcc       = dt.Rows[0]["byAcc"].ToString();
                    loginstatus = LoginStatus.Login;
                    string roleCode = dt.Rows[0]["role_code"].ToString();
                    switch (roleCode)
                    {
                    case "1":
                        role = User_Role.Administrator;
                        break;

                    case "2":
                        role = User_Role.AccountManager;
                        break;

                    case "3":
                        role = User_Role.CenterSupervisor;
                        break;

                    case "4":
                        role = User_Role.CenterOfficer;
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    isValid     = false;
                    loginstatus = LoginStatus.Logout;
                }
            }
        }
コード例 #2
0
ファイル: SysSetting.cs プロジェクト: Proview-KUMA/108ARMY
        public static DataTable GetCenterFromMemo(string _memo)
        {
            DataTable center = new DataTable();
            Dictionary <string, object> d = new Dictionary <string, object>();

            Lib.DataUtility du = new Lib.DataUtility();
            if (_memo.Contains("E") || _memo.Contains("F"))
            {
                d.Add("IsSwin", true);
                center = du.getDataTableByText("select center_code from Center where IsSwin = @IsSwin", d);
            }
            else
            {
                center = du.getDataTableByText("select center_code from Center");
            }
            return(center);
        }
コード例 #3
0
        private void NewReplaceitem_Load(object sender, EventArgs e)
        {
            this.KeyPreview = true;//開啟鍵盤觸發事件
            try
            {
                center_code = System.Configuration.ConfigurationManager.AppSettings["centercode"].ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("讀取單位代碼失敗,請檢查config設定檔");
            }


            //讀取項目
            try
            {
                Dic_Item = new Dictionary <string, string>();
                Lib.DataUtility             du = new Lib.DataUtility();
                Dictionary <string, object> d  = new Dictionary <string, object>();
                d.Add("center_code", center_code);
                DataTable dt_isSwin = du.getDataTableByText("select IsSwin from Center where center_code = @center_code", d);
                DataTable dt        = new DataTable();
                if (dt_isSwin.Rows.Count > 0)
                {
                    d.Clear();
                    //有游泳項目
                    if (Convert.ToBoolean(dt_isSwin.Rows[0]["IsSwin"]))
                    {
                        d.Add("Gender", m_parent.Gender);
                        dt = du.getDataTableBysp("GetRepMent", d);
                    }
                    else
                    {   //沒有游泳項目
                        d.Add("Gender", m_parent.Gender);
                        dt = du.getDataTableBysp("GetRepMentNonSwin", d);
                    }
                }
                if (dt.Rows.Count > 0)
                {
                    cbb_RepItem1.Items.Add("請選擇替代項目");
                    cbb_RepItem2.Items.Add("請選擇替代項目");
                    cbb_RepItem3.Items.Add("請選擇替代項目");
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Dic_Item.Add(dt.Rows[i]["rep_title"].ToString(), dt.Rows[i]["sid"].ToString());
                        cbb_RepItem1.Items.Add(dt.Rows[i]["rep_title"].ToString());
                        cbb_RepItem2.Items.Add(dt.Rows[i]["rep_title"].ToString());
                        cbb_RepItem3.Items.Add(dt.Rows[i]["rep_title"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
            }
            cbb_RepItem1.SelectedIndex = 0;
            cbb_RepItem2.SelectedIndex = 0;
            cbb_RepItem3.SelectedIndex = 0;
        }
コード例 #4
0
        public ReplaceitemRace(Form3 mpform)
        {
            InitializeComponent();
            m_parent = mpform;
            checkedListBox1.Items.Clear();
            checkedListBox2.Items.Clear();
            checkedListBox1.Items.Add("二分鐘仰臥起坐", false);
            checkedListBox1.Items.Add("二分鐘俯地挺身", false);
            checkedListBox1.Items.Add("三千公尺徒手跑步", false);

            try
            {
                Lib.DataUtility du_center = new Lib.DataUtility();
                DataTable       dt_center = du_center.getDataTableByText("select distinct C.center_code as center_code, C.center_name as center_name  from Result R, Center C where R.center_code = C.center_code");
                if (dt_center.Rows.Count == 1)
                {
                    center_code = dt_center.Rows[0]["center_code"].ToString();
                    center_name = dt_center.Rows[0]["center_name"].ToString();
                }
            }
            catch (Exception ex)
            {
            }

            try
            {
                Lib.DataUtility             du = new Lib.DataUtility();
                Dictionary <string, object> d  = new Dictionary <string, object>();
                d.Add("center_code", center_code);
                DataTable dt_isSwin = du.getDataTableByText("select IsSwin from Center where center_code = @center_code", d);
                DataTable dt        = new DataTable();
                if (dt_isSwin.Rows.Count > 0)
                {
                    d.Clear();
                    //有游泳項目
                    if (Convert.ToBoolean(dt_isSwin.Rows[0]["IsSwin"]))
                    {
                        d.Add("Gender", m_parent.Gender);
                        dt = du.getDataTableBysp("GetRepMent", d);
                    }
                    else
                    {   //沒有游泳項目
                        d.Add("Gender", m_parent.Gender);
                        dt = du.getDataTableBysp("GetRepMentNonSwin", d);
                    }
                }
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        checkedListBox2.Items.Add(dt.Rows[i]["rep_title"].ToString(), false);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #5
0
        public _3K_Change(Form1 mpform)
        {
            InitializeComponent();
            m_parent = mpform;

            try
            {
                //取得鑑測站名稱
                Lib.DataUtility du_center = new Lib.DataUtility();
                DataTable       dt_center = du_center.getDataTableByText("select distinct C.center_code as center_code, C.center_name as center_name  from Result R, Center C where R.center_code = C.center_code ");
                if (dt_center.Rows.Count == 1)
                {
                    center_code = dt_center.Rows[0]["center_code"].ToString();
                    center_name = dt_center.Rows[0]["center_name"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("連接資料庫異常,無法取得鑑測中心代碼及名稱。" + Environment.NewLine + ex.Message);
            }

            try
            {
                Lib.DataUtility             du = new Lib.DataUtility();
                Dictionary <string, object> d  = new Dictionary <string, object>();
                d.Add("center_code", center_code);
                DataTable dt_isSwin = du.getDataTableByText("select IsSwin from Center where center_code = @center_code", d);
                DataTable dt        = new DataTable();
                if (dt_isSwin.Rows.Count > 0)
                {
                    d.Clear();
                    //判斷鑑測中心有無泳池
                    if (Convert.ToBoolean(dt_isSwin.Rows[0]["IsSwin"]))
                    {
                        //有游泳項目
                        rbt_800_Swim.Visible = true;
                    }
                    else
                    {
                        //沒有游泳項目
                        rbt_800_Swim.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("連接資料庫異常,無法取得鑑測中心是否開放泳池項目。" + Environment.NewLine + ex.Message);
            }
        }
コード例 #6
0
ファイル: Unit.cs プロジェクト: Proview-KUMA/108ARMY
        /// <summary>
        /// Unit Tree Contruct For Format All Unit Tree From DataBase
        /// </summary>
        public UnitTree()
        {
            Lib.DataUtility du = new Lib.DataUtility();
            DataTable       dt = du.getDataTableByText("select * from unit", null);

            d = new Dictionary <string, Lib.Unit>();
            foreach (DataRow row in dt.Rows)
            {
                Lib.Unit unit = new Lib.Unit();
                unit.Unit_Code        = row["unit_code"].ToString();
                unit.Parent_Unit_Code = row["parent_unit_code"].ToString();
                unit.Unit_Title       = row["unit_title"].ToString();
                unit.Service_Code     = row["service_code"].ToString();
                d.Add(unit.Unit_Code, unit);
            }
            foreach (KeyValuePair <string, Lib.Unit> item in d)
            {
                Lib.Unit u = (Lib.Unit)item.Value;
                //if (u.Parent_Unit_Code != "")
                //{
                var parent_code = u.Parent_Unit_Code;
                foreach (KeyValuePair <string, Lib.Unit> parent in d)
                {
                    if (parent_code == ((Lib.Unit)parent.Value).Unit_Code)
                    {
                        if (((Lib.Unit)parent.Value).ChildUnit == null)
                        {
                            u.Parent_Title = ((Lib.Unit)parent.Value).Unit_Title;

                            ((Lib.Unit)parent.Value).ChildUnit = new Dictionary <string, Lib.Unit>();

                            ((Lib.Unit)parent.Value).ChildUnit.Add(u.Unit_Code, u);
                        }
                        else
                        {
                            u.Parent_Title = ((Lib.Unit)parent.Value).Unit_Title;

                            ((Lib.Unit)parent.Value).ChildUnit.Add(u.Unit_Code, u);
                        }
                        break;
                    }
                }
                //}
            }
        }