Exemplo n.º 1
0
 // GET: HRAdd
 public ActionResult Index()
 {
     try
     {
         if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
         {
             TempData["SessionExipred"] = "true";
             return(RedirectToAction("Index", "Login", null));
         }
         MysqlDBA <CodeBase> mysqlDBA  = new MysqlDBA <CodeBase>(FunctionController.CONNSTR);
         CodeBase            queryCrit = new CodeBase();
         queryCrit.CodeTable = "HRAlloc";
         queryCrit.CodeField = "ProfBack";
         List <CodeBase> objLst = (List <CodeBase>)mysqlDBA.getDataList(queryCrit);
         TempData["CodeBase"] = objLst;
     }
     catch (Exception ex)
     {
         Log.Error(ex + ex.StackTrace);
         TempData["action"] = "Function";
         TempData["error"]  = ex + ex.StackTrace;
         //tran.Rollback();
         return(RedirectToAction("Index", "HRAdd", null));
     }
     return(View());
 }
Exemplo n.º 2
0
        // GET: HR
        public ActionResult Index(int page = 1)
        {
            if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
            {
                //Log.Error(ex + ex.StackTrace);
                TempData["SessionExipred"] = "true";
                //TempData["error"] = ex + ex.StackTrace;
                //tran.Rollback();
                return(RedirectToAction("Index", "Login", null));
            }
            MysqlDBA <HRAlloc>   dbaHRAlloc   = new MysqlDBA <HRAlloc>(FunctionController.CONNSTR);
            MysqlDBA <UnitAYear> dbaUnitAYear = new MysqlDBA <UnitAYear>(FunctionController.CONNSTR);
            List <HRAlloc>       listData     = new List <HRAlloc>();
            HRData hrData = new HRData();

            try
            {
                UnitAYear queryCritUAY = new UnitAYear();
                queryCritUAY.INSTNO = Session["INSTNO"].ToString();
                queryCritUAY.Year   = (DateTime.Now.Year - 1911).ToString();
                List <UnitAYear> UAYS = (List <UnitAYear>)dbaUnitAYear.getDataList(queryCritUAY);

                HRAlloc queryCrit = new HRAlloc();
                queryCrit.Year   = (DateTime.Now.Year - 1911).ToString();
                queryCrit.INSTNO = Session["INSTNO"].ToString();
                DataSet ds = dbaHRAlloc.getDataSet(string.Format("SELECT * FROM HRAlloc WHERE Year='{0}' AND INSTNO='{1}'", queryCrit.Year, queryCrit.INSTNO));
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    HRAlloc data = new HRAlloc();
                    data.Year         = row["Year"].ToString();
                    data.INSTNO       = row["INSTNO"].ToString();
                    data.HRAllocSerNo = int.Parse(row["HRAllocSerNo"].ToString());
                    data.JobType      = row["JobType"].ToString();
                    data.PROBG        = row["PROBG"].ToString();
                    data.FullTimeNum  = int.Parse(row["FullTimeNum"].ToString());
                    data.PartTimeNum  = int.Parse(row["PartTimeNum"].ToString());
                    listData.Add(data);
                }
                List <CodeBase> codeBaseData = new List <CodeBase>();
                codeBaseData      = (List <CodeBase>) new MysqlDBA <CodeBase>(FunctionController.CONNSTR).getAllDataList(new CodeBase());
                hrData.hrDataList = listData.OrderBy(p => p.HRAllocSerNo).ToPagedList(page == 0 ? 1 : page, DefaultPageSize);
                if (UAYS.Count > 0)
                {
                    hrData.YearLeaveCnt = UAYS[0].ResignNum;
                    hrData.YearStartCnt = UAYS[0].CMDBegYearNum;
                    hrData.RateAddCnt   = UAYS[0].CMDPeriodAddNum;
                }
                TempData["CodeBase"] = codeBaseData;
            }
            catch (Exception ex)
            {
                Log.Error(ex + ex.StackTrace);
                TempData["action"] = "Function";
                TempData["error"]  = ex + ex.StackTrace;
                //tran.Rollback();
                return(RedirectToAction("Index", "HR", null));
            }
            return(View(hrData));
        }
Exemplo n.º 3
0
        public ActionResult Index(HRData data)
        {
            if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
            {
                //Log.Error(ex + ex.StackTrace);
                TempData["SessionExipred"] = "true";
                //TempData["error"] = ex + ex.StackTrace;
                //tran.Rollback();
                return(RedirectToAction("Index", "Login", null));
            }
            UnitAYear unitAYear = new UnitAYear();

            MysqlDBA <UnitAYear> mysqlDBA = new MysqlDBA <UnitAYear>(FunctionController.CONNSTR);

            try
            {
                unitAYear.INSTNO = Session["INSTNO"].ToString();
                unitAYear.Year   = (DateTime.Now.Year - 1911).ToString();
                List <UnitAYear> unitAYears = (List <UnitAYear>)mysqlDBA.getDataList(unitAYear);
                if (unitAYears.Count > 0)
                {
                    unitAYear = unitAYears[0];
                }
                unitAYear.ResignNum       = data.YearLeaveCnt;
                unitAYear.CMDBegYearNum   = data.YearStartCnt;
                unitAYear.CMDPeriodAddNum = data.RateAddCnt;
                unitAYear.Modifydate      = DateTime.Now.ToString("yyyy-MM-dd");
                if (!string.IsNullOrEmpty(unitAYear.EvalDate))
                {
                    unitAYear.EvalDate = DateTime.Parse(unitAYear.EvalDate).ToString("yyyy-MM-dd");
                }
                if (!string.IsNullOrEmpty(unitAYear.CreateDate))
                {
                    unitAYear.CreateDate = DateTime.Parse(unitAYear.CreateDate).ToString("yyyy-MM-dd");
                }
                unitAYear.ModifyUser = Session["AccountNo"].ToString();
                mysqlDBA.InsertOrUpdate(unitAYear);
            }
            catch (Exception ex)
            {
                Log.Error(ex + ex.StackTrace);
                TempData["action"] = "Function";
                TempData["error"]  = ex + ex.StackTrace;
                //tran.Rollback();
                return(RedirectToAction("Index", "HR", null));
            }
            return(RedirectToAction("Index", "CaseListCount", null));
        }
Exemplo n.º 4
0
        public static List <CaseSvrEff> getCaseSvrEff(string year, string yearMonth, string INSTNO, string code)
        {
            List <CaseSvrEff> strRet = new List <CaseSvrEff>();

            try
            {
                MysqlDBA <CaseSvrEff> dba       = new MysqlDBA <CaseSvrEff>(FunctionController.CONNSTR);
                CaseSvrEff            queryCrit = new CaseSvrEff();
                queryCrit.Year    = year;
                queryCrit.YM      = yearMonth;
                queryCrit.INSTNO  = INSTNO;
                queryCrit.SvrType = code;
                strRet            = (List <CaseSvrEff>)dba.getDataList(queryCrit);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(strRet);
        }
Exemplo n.º 5
0
        // GET: SupportUnit
        public ActionResult Index(int page = 1)
        {
            List <UnitAToBSum> listData = new List <UnitAToBSum>();
            SupportUnitAdd     model    = new SupportUnitAdd();

            try
            {
                if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
                {
                    //Log.Error(ex + ex.StackTrace);
                    TempData["SessionExipred"] = "true";
                    //TempData["error"] = ex + ex.StackTrace;
                    //tran.Rollback();
                    return(RedirectToAction("Index", "Login", null));
                }
                MysqlDBA <UnitAToBSum> dbaHRAlloc = new MysqlDBA <UnitAToBSum>(FunctionController.CONNSTR);
                UnitAToBSum            queryCrit  = new UnitAToBSum();
                queryCrit.Year = (DateTime.Now.Year - 1911).ToString();
                if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
                {
                    TempData["SessionExipred"] = "true";
                    return(RedirectToAction("Index", "Login", null));
                }
                queryCrit.INSTNO   = Session["INSTNO"].ToString();
                listData           = (List <UnitAToBSum>)dbaHRAlloc.getDataList(queryCrit);
                model.SupportUnits = listData.OrderBy(p => p.TrSeialNo).ToPagedList(page, defaultPageSize);
                List <CodeBase> codeBaseData = new List <CodeBase>();
                codeBaseData = (List <CodeBase>) new MysqlDBA <CodeBase>(FunctionController.CONNSTR).getAllDataList(new CodeBase());
                //TempData["UnitAToBSumList"] = listData;
                TempData["CodeBase"] = codeBaseData;
            }
            catch (Exception ex)
            {
                Log.Error(ex + ex.StackTrace);
                TempData["action"] = "Function";
                TempData["error"]  = ex + ex.StackTrace;
                //tran.Rollback();
                return(RedirectToAction("Index", "SupportUnit", null));
            }
            return(View(model));
        }
Exemplo n.º 6
0
        public static string getINSTName(string INSTNO)
        {
            string strRet = string.Empty;

            try
            {
                MysqlDBA <INSTBase> mysqlDBA_AttrBase = new MysqlDBA <INSTBase>(FunctionController.CONNSTR);
                INSTBase            baseattr          = new INSTBase();
                baseattr.INSTNO = INSTNO;
                List <INSTBase> objLst = (List <INSTBase>)mysqlDBA_AttrBase.getDataList(baseattr);
                if (objLst.Count > 0)
                {
                    strRet = objLst[0].INSTName;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(strRet);
        }
Exemplo n.º 7
0
        public static string getBaseAttr(string attrMed)
        {
            string strRet = string.Empty;

            try
            {
                MysqlDBA <AttrBase> mysqlDBA_AttrBase = new MysqlDBA <AttrBase>(FunctionController.CONNSTR);
                AttrBase            baseattr          = new AttrBase();
                baseattr.AttrCode = attrMed;
                List <AttrBase> objLst = (List <AttrBase>)mysqlDBA_AttrBase.getDataList(baseattr);
                if (objLst.Count > 0)
                {
                    strRet = objLst[0].AttrName;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(strRet);
        }
Exemplo n.º 8
0
        public static string getScoreTitle(string itemNo)
        {
            string strRet = string.Empty;

            try
            {
                MysqlDBA <ScoreItem> mysqlDBA_AttrBase = new MysqlDBA <ScoreItem>(FunctionController.CONNSTR);
                ScoreItem            baseattr          = new ScoreItem();
                baseattr.ItemNo = itemNo;
                List <ScoreItem> objLst = (List <ScoreItem>)mysqlDBA_AttrBase.getDataList(baseattr);
                if (objLst.Count > 0)
                {
                    strRet = objLst[0].ItemDesc;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(strRet);
        }
Exemplo n.º 9
0
        // GET: ScoreDesc
        public ActionResult Index(string ItemNo)
        {
            if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
            {
                //Log.Error(ex + ex.StackTrace);
                TempData["SessionExipred"] = "true";
                //TempData["error"] = ex + ex.StackTrace;
                //tran.Rollback();
                return(RedirectToAction("Index", "Login", null));
            }
            ScoreDescView view = new ScoreDescView();

            view.scoreDesc = string.Empty;
            try
            {
                MysqlDBA <ScoreDesc> mysqlDBA  = new MysqlDBA <ScoreDesc>(FunctionController.CONNSTR);
                ScoreDesc            queryCrit = new ScoreDesc();
                queryCrit.EvalYear = (DateTime.Now.Year - 1911).ToString();
                queryCrit.EvalType = "A";
                queryCrit.ItemNo   = ItemNo;
                List <ScoreDesc> scoreDescs = (List <ScoreDesc>)mysqlDBA.getDataList(queryCrit);
                if (scoreDescs.Count > 0)
                {
                    view.scoreDesc  = scoreDescs[0].Description;
                    view.scoreTitle = Utility.Utility.getScoreTitle(ItemNo);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex + ex.StackTrace);
                TempData["action"] = "Function";
                TempData["error"]  = ex + ex.StackTrace;
                //tran.Rollback();
                return(RedirectToAction("Index", "SelfRate", null));
            }
            return(View(view));
        }
Exemplo n.º 10
0
 public ActionResult Login(FormCollection post)
 {
     if (ModelState.IsValid)
     {
         string account = string.Empty;
         //this.IsCaptchaValid("Captcha is not valid");
         string   password = string.Empty;
         CodeBase roleCode = new CodeBase();
         roleCode.CodeTable = "AccountBase";
         roleCode.CodeField = "AccountType";
         List <CodeBase> roleCodeList = (List <CodeBase>) new MysqlDBA <CodeBase>(FunctionController.CONNSTR).getDataList(roleCode);
         Log.Info("Login-page started...");
         try
         {
             account  = post["AccountNo"];
             password = post["AcntPwd"];
             AccountBase accountBase = new AccountBase();
             accountBase.AccountNo = account;
             MysqlDBA <AccountBase> accountBaseDB    = new MysqlDBA <AccountBase>(ConfigurationManager.ConnectionStrings["MysqlConn"].ConnectionString);
             List <AccountBase>     accountBasesList = (List <AccountBase>)accountBaseDB.getDataList(accountBase);
             if (accountBasesList.Count == 0)
             {
                 TempData["action"] = "query";
                 TempData["error"]  = "無此帳號:" + account;
                 return(RedirectToAction("Index", "Login", null));
             }
             bool verifyPasswd = false;
             //檢查使用者角色,有則帶到主頁面
             bool userRole = false;
             accountBasesList.ForEach(o =>
             {
                 if (o.AccountNo == account)
                 {
                     if (o.AcntPwd == password)
                     {
                         verifyPasswd           = true;
                         Session["INSTNO"]      = o.AcntTypeNo;
                         Session["AccountNo"]   = account;
                         Session["AccountName"] = o.AcoountName;
                         Session["AccountBase"] = o;
                         roleCodeList.ForEach(t =>
                         {
                             if (o.AccountType.Trim() == t.CodeValue.Trim())
                             {
                                 userRole            = true;
                                 Session["userRole"] = o.AccountType;
                             }
                         });
                     }
                 }
             });
             if (!verifyPasswd)
             {
                 TempData["action"] = "query";
                 TempData["error"]  = "帳號:" + account + "密碼錯誤!";
                 return(RedirectToAction("Index", "Login", null));
             }
             if (!userRole)
             {
                 TempData["action"] = "query";
                 TempData["error"]  = "帳號:" + account + "未設系統定角色!";
                 return(RedirectToAction("Index", "Login", null));
             }
         }
         catch (Exception ex)
         {
             Log.Error(ex + ex.StackTrace);
             TempData["action"] = "query";
             TempData["error"]  = ex + ex.StackTrace;
             return(RedirectToAction("Index", "Login", null));
         }
         TempData["action"]   = "query";
         Session["AccountNo"] = account;
         return(RedirectToAction("Index", "Home", null));
     }
     else
     {
     }
     if (Session["userRole"] != null && Session["userRole"].ToString() == "1")
     {
         TempData["action"] = "query";
     }
     else
     {
         TempData["error"] = "Error: 連線失效或無效的驗證碼,請重新登入.";
         return(RedirectToAction("Index", "Login", null));
     }
     if (Session["userRole"].ToString() == "2")
     {
         TempData["action"] = "committee";
     }
     if (Session["userRole"].ToString() == "9")
     {
         TempData["action"] = "admin";
     }
     TempData["error"] = "Error: 無效的驗證碼.";
     return(RedirectToAction("Index", "Login", null));
 }
Exemplo n.º 11
0
        public ActionResult BasicData(string accountNo)
        {
            if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
            {
                TempData["SessionExipred"] = "true";
                return(RedirectToAction("Index", "Login", null));
            }
            MysqlDBA <INSTBase>  instBaseDBA = new MysqlDBA <INSTBase>(FunctionController.CONNSTR);
            MysqlDBA <UnitAYear> mysqlDBAUAY = new MysqlDBA <UnitAYear>(FunctionController.CONNSTR);

            if (accountNo == null)
            {
                TempData["SessionExipred"] = "true";
                return(View("Index", "Login", null));
            }
            string    INSTNO    = accountNo;//((string[)accountNo)[0].ToString();
            BasicData basicData = new BasicData();
            INSTBase  instBase  = new INSTBase();
            UnitAYear queryCrit = new UnitAYear();

            queryCrit.Year   = (DateTime.Now.Year - 1911).ToString();
            queryCrit.INSTNO = INSTNO;
            List <UnitAYear> listResult = (List <UnitAYear>)mysqlDBAUAY.getDataList(queryCrit);
            UnitAYear        result     = new UnitAYear();

            if (listResult.Count > 0)
            {
                result = listResult[0];
            }
            try
            {
                instBase.INSTNO = INSTNO;
                List <INSTBase> objInstList = (List <INSTBase>)instBaseDBA.getDataList(instBase);
                if (objInstList.Count > 0)
                {
                    basicData.INSTNO   = objInstList[0].INSTNO;
                    basicData.INSTName = objInstList[0].INSTName;
                    basicData.INSTTel  = objInstList[0].INSTTel;
                    basicData.address  = objInstList[0].INSTAddress;
                    basicData.Contact  = result.Contact;
                    basicData.AttrMed  = Utility.Utility.getBaseAttr(objInstList[0].AttrMed);;
                    if (objInstList.Count > 0 && objInstList[0] != null && !string.IsNullOrEmpty(objInstList[0].IncDate))
                    {
                        basicData.EstabDate = (DateTime.Parse(objInstList[0].IncDate).Year - 1911).ToString() + "年"
                                              + DateTime.Parse(objInstList[0].IncDate).Month + "月"
                                              + DateTime.Parse(objInstList[0].IncDate).Day + "日";
                    }
                    basicData.SpecialArea     = result.MainAreas;
                    basicData.EMail           = result.EMail;
                    basicData.ResignNum       = result.ResignNum;
                    basicData.CMDBegYearNum   = result.CMDBegYearNum;
                    basicData.CMDPeriodAddNum = result.CMDPeriodAddNum;
                    HRAlloc hRAlloc = new HRAlloc();
                    hRAlloc.INSTNO = INSTNO;
                    hRAlloc.Year   = (DateTime.Now.Year - 1911).ToString();
                    //人力配置
                    basicData.hrAlloc = Utility.Utility.getHRAlloc(hRAlloc);
                    foreach (HRAlloc alloc in basicData.hrAlloc)
                    {
                        alloc.JobType     = Utility.Utility.getCodeBaseText((List <CodeBase>) new MysqlDBA <CodeBase>(FunctionController.CONNSTR).getDataList(new CodeBase()), "HRAlloc", "JobType", alloc.JobType);
                        alloc.PROBG       = Utility.Utility.getCodeBaseText((List <CodeBase>) new MysqlDBA <CodeBase>(FunctionController.CONNSTR).getDataList(new CodeBase()), "HRAlloc", "ProfBack", alloc.PROBG);
                        alloc.FullTimeNum = alloc.FullTimeNum;
                        alloc.PartTimeNum = alloc.PartTimeNum;
                    }
                    //合作提供服務單位
                    List <UnitAToBSum>     list         = new List <UnitAToBSum>();
                    MysqlDBA <UnitAToBSum> mysqlDBA_UAB = new MysqlDBA <UnitAToBSum>(FunctionController.CONNSTR);
                    UnitAToBSum            queryCritUAB = new UnitAToBSum();
                    queryCritUAB.Year   = (DateTime.Now.Year - 1911).ToString();
                    queryCritUAB.INSTNO = INSTNO;
                    list = (List <UnitAToBSum>)mysqlDBA_UAB.getDataListNoKey(queryCritUAB);
                    basicData.unitAToBSums = list;
                    //個管服務量
                    List <CaseSvr>     listCaseSvr      = new List <CaseSvr>();
                    MysqlDBA <CaseSvr> mysqlDBA_CaseSvr = new MysqlDBA <CaseSvr>(FunctionController.CONNSTR);
                    CaseSvr            queryCritCaseSvr = new CaseSvr();
                    queryCritCaseSvr.Year   = (DateTime.Now.Year - 1911).ToString();
                    queryCritCaseSvr.INSTNO = INSTNO;
                    listCaseSvr             = (List <CaseSvr>)mysqlDBA_CaseSvr.getDataList(queryCritCaseSvr);
                    basicData.caseSvrs      = listCaseSvr;
                    //個管服務時效
                    List <CaseSvrEff>     listCaseSvrEff      = new List <CaseSvrEff>();
                    MysqlDBA <CaseSvrEff> mysqlDBA_CaseSvrEff = new MysqlDBA <CaseSvrEff>(FunctionController.CONNSTR);
                    CaseSvrEff            queryCritCaseSvrEff = new CaseSvrEff();
                    queryCritCaseSvrEff.Year   = (DateTime.Now.Year - 1911).ToString();
                    queryCritCaseSvrEff.INSTNO = INSTNO;
                    listCaseSvrEff             = (List <CaseSvrEff>)mysqlDBA_CaseSvrEff.getDataList(queryCritCaseSvrEff);
                    basicData.caseSvrsEff      = listCaseSvrEff;
                    CaseSvrEffView obj = null;
                    foreach (CaseSvrEff eff in basicData.caseSvrsEff)
                    {
                        var viewObj = from vo in basicData.caseSvrsEffView
                                      where vo.Year == eff.Year && vo.YM == eff.YM && vo.INSTNO == eff.INSTNO
                                      select vo;
                        if (viewObj.ToList().Count > 0)
                        {
                            obj = (CaseSvrEffView)viewObj.ToList()[0];
                        }
                        else
                        {
                            obj        = new CaseSvrEffView();
                            obj.Year   = eff.Year;
                            obj.YM     = eff.YM;
                            obj.INSTNO = eff.INSTNO;
                            basicData.caseSvrsEffView.Add(obj);
                        }
                        if (eff.SvrType == "01")
                        {
                            obj._01UpAvgDays = eff.UpAvgDays;
                        }
                        if (eff.SvrType == "02")
                        {
                            obj._02UpCasePer = eff.UpCasePer;
                        }
                        if (eff.SvrType == "03")
                        {
                            obj._03UpCasePer = eff.UpCasePer;
                        }
                    }
                    if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
                    {
                        TempData["SessionExipred"] = "true";
                        return(RedirectToAction("Index", "Login", null));
                    }
                    //社區資源網絡會議
                    List <UnitAMeeting> lstCommResMeeting = (List <UnitAMeeting>) new MysqlDBA <UnitAMeeting>(FunctionController.CONNSTR).getDataListNoKey(
                        new UnitAMeeting()
                    {
                        INSTNO = Session["INSTNO"].ToString(), MType = "1"
                    }
                        );
                    lstCommResMeeting.ForEach(o => o.MDate = Utility.Utility.convertUDT2ROCDateFormat(o.MDate));
                    basicData.commResMeeting = lstCommResMeeting;
                    //區域跨專業個案討論會
                    List <UnitAMeeting> lstAreaProfMeeting = (List <UnitAMeeting>) new MysqlDBA <UnitAMeeting>(FunctionController.CONNSTR).getDataListNoKey(
                        new UnitAMeeting()
                    {
                        INSTNO = Session["INSTNO"].ToString(), MType = "2"
                    }
                        );
                    lstAreaProfMeeting.ForEach(o => o.MDate = Utility.Utility.convertUDT2ROCDateFormat(o.MDate));
                    basicData.areaProfMeeting = lstAreaProfMeeting;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex + ex.StackTrace);
                TempData["action"] = "query";
                TempData["error"]  = ex + ex.StackTrace;
                return(View("Index", "Function", null));
            }
            return(View(basicData));
        }
Exemplo n.º 12
0
        // GET: Function
        public ActionResult Index()
        {
            MysqlDBA <AccountBase> mysqlDBA_AccountBase = new MysqlDBA <AccountBase>(CONNSTR);
            MysqlDBA <INSTBase>    mysqlDBA_INSTBase    = new MysqlDBA <INSTBase>(CONNSTR);
            MysqlDBA <CityBase>    mysqlDBA_CityBase    = new MysqlDBA <CityBase>(CONNSTR);
            MysqlDBA <AreaBase>    mysqlDBA_AreaBase    = new MysqlDBA <AreaBase>(CONNSTR);

            MysqlDBA <UnitAYear> mysqlDBA_UnitAYear = new MysqlDBA <UnitAYear>(CONNSTR);
            BasicData            model = new BasicData();

            try
            {
                if (Session["INSTNO"] == null || string.IsNullOrEmpty(Session["INSTNO"].ToString()))
                {
                    TempData["SessionExipred"] = "true";
                    return(RedirectToAction("Index", "Login", null));
                }
                string accountNo = Session["AccountNo"].ToString();

                AccountBase accountBase = new AccountBase();
                accountBase.AccountNo = accountNo;
                INSTBase           baseData        = null;
                List <AccountBase> listdataAccount = (List <AccountBase>)mysqlDBA_AccountBase.getDataList(accountBase);
                if (listdataAccount.Count > 0)
                {
                    INSTBase inst = new INSTBase();
                    inst.INSTNO = listdataAccount[0].AcntTypeNo;
                    List <INSTBase> listdataInst = (List <INSTBase>)mysqlDBA_INSTBase.getDataList(inst);
                    if (listdataInst.Count > 0)
                    {
                        baseData        = listdataInst[0];
                        model.INSTName  = baseData.INSTName;
                        model.INSTTel   = baseData.INSTTel;
                        model.EstabDate = Utility.Utility.convertUDT2ROCDateFormat(baseData.IncDate);
                        if (!string.IsNullOrEmpty(baseData.INSTAddress))
                        {
                            model.city    = Utility.Utility.getCityCode(baseData.INSTAddress.Substring(0, 3));
                            model.area    = Utility.Utility.getAreaCode(baseData.INSTAddress.Substring(3, 3));
                            model.address = baseData.INSTAddress.Substring(6);
                        }
                        model.AttrMed = baseData.AttrMed;
                        if (baseData.IncDate != null)
                        {
                            model.EstabDate = Utility.Utility.convertUDT2ROCDateFormat(baseData.IncDate.ToString());
                        }
                        //model.AttrLC = baseData.AttrLC;
                        //model.AttrOther = baseData.AttrOther;
                        ViewBag.city = (List <CityBase>)mysqlDBA_CityBase.getAllDataList(new CityBase());
                        ViewBag.area = (List <AreaBase>)mysqlDBA_AreaBase.getAllDataList(new AreaBase());
                        UnitAYear unitAYear = new UnitAYear();
                        unitAYear.Year   = (DateTime.Now.Year - 1911).ToString();
                        unitAYear.INSTNO = baseData.INSTNO;
                        List <UnitAYear> uaYList = (List <UnitAYear>)mysqlDBA_UnitAYear.getDataList(unitAYear);
                        if (uaYList.Count > 0)
                        {
                            ViewBag.uaYList   = uaYList[0];
                            model.SpecialArea = uaYList[0].MainAreas;
                        }
                        model.AttrMedList = Utility.Utility.getAttrList(AttrBase.TypeList.Medical);
                        model.AttrMedList.AddRange(Utility.Utility.getAttrList(AttrBase.TypeList.Longterm));
                        model.AttrMedList.AddRange(Utility.Utility.getAttrList(AttrBase.TypeList.Other));
                        //model.AttrLCList = Utility.Utility.getAttrList(AttrBase.TypeList.Longterm);
                        //model.AttrOtherList = Utility.Utility.getAttrList(AttrBase.TypeList.Other);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex + ex.StackTrace);
                TempData["action"] = "query";
                TempData["error"]  = ex + ex.StackTrace;
                return(RedirectToAction("Index", "Login", null));
            }
            return(View(model));
        }