示例#1
0
 public ActionResult Delete(string year, string INSTNO, string HRAllocSerNo)
 {
     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));
         }
         HRAlloc queryCrit = new HRAlloc();
         queryCrit.Year         = year;
         queryCrit.INSTNO       = INSTNO;
         queryCrit.HRAllocSerNo = int.Parse(HRAllocSerNo);
         MysqlDBA <HRAlloc> mysqlDBA = new MysqlDBA <HRAlloc>(FunctionController.CONNSTR);
         mysqlDBA.Delete(queryCrit);
         TempData["success"]      = "OK";
         TempData["parentreload"] = "OK";
     }
     catch (Exception ex)
     {
         Log.Error(ex + ex.StackTrace);
         TempData["action"] = "Function";
         TempData["error"]  = ex + ex.StackTrace;
         //tran.Rollback();
         return(RedirectToAction("Index", "HRAdd", null));
     }
     return(RedirectToAction("Index", "HRAdd", null));
 }
示例#2
0
        public static List <HRAlloc> getHRAlloc(HRAlloc hRAlloc)
        {
            List <HRAlloc> listData = new List <HRAlloc>();

            try
            {
                MysqlDBA <HRAlloc> dbaHRAlloc = new MysqlDBA <HRAlloc>(FunctionController.CONNSTR);
                DataSet            ds         = dbaHRAlloc.getDataSet(string.Format("SELECT * FROM HRAlloc WHERE Year='{0}' AND INSTNO='{1}'", hRAlloc.Year, hRAlloc.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);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(listData);
        }
示例#3
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));
        }
示例#4
0
        public ActionResult Add(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));
            }
            try
            {
                MysqlDBA <HRAlloc> mysqlDBA = new MysqlDBA <HRAlloc>(FunctionController.CONNSTR);
                HRAlloc            alloc    = new HRAlloc();
                alloc.Year   = (DateTime.Now.Year - 1911).ToString();
                alloc.INSTNO = Session["INSTNO"].ToString();
                //-1代表新增,取新流水號
                if (data.HRAllocSerNo1 == "-1")
                {
                    alloc.HRAllocSerNo = Utility.Utility.getHRAllocSerNo(mysqlDBA);
                    alloc.HRAllocSerNo++;
                }
                else
                {
                    //不是-1表修改,帶原來流水號
                    alloc.HRAllocSerNo = int.Parse(data.HRAllocSerNo1);
                }

                alloc.JobType     = data.personadmin;
                alloc.PROBG       = data.ProfBackSelect;
                alloc.FullTimeNum = int.Parse(data.ProfCount);
                alloc.PartTimeNum = int.Parse(data.BeitCount);
                alloc.Modifydate  = DateTime.Now.ToString("yyyy-MM-dd");
                alloc.CreateDate  = DateTime.Now.ToString("yyyy-MM-dd");
                mysqlDBA.InsertOrUpdate(alloc);
                TempData["success"]      = "OK";
                TempData["parentreload"] = "OK";
                //alloc
            }
            catch (Exception ex)
            {
                Log.Error(ex + ex.StackTrace);
                TempData["action"] = "Function";
                TempData["error"]  = ex + ex.StackTrace;
                //tran.Rollback();
                return(RedirectToAction("Index", "HRAdd", null));
            }
            return(RedirectToAction("Index", "HRAdd", null));
        }
示例#5
0
 public ActionResult Edit(string year, string INSTNO, string HRAllocSerNo)
 {
     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));
         }
         List <HRAlloc> listData  = new List <HRAlloc>();
         HRAlloc        queryCrit = new HRAlloc();
         queryCrit.Year         = year;
         queryCrit.INSTNO       = INSTNO;
         queryCrit.HRAllocSerNo = int.Parse(HRAllocSerNo);
         MysqlDBA <HRAlloc> mysqlDBA = new MysqlDBA <HRAlloc>(FunctionController.CONNSTR);
         DataSet            ds       = mysqlDBA.getDataSet(string.Format("SELECT * FROM HRAlloc WHERE Year='{0}' AND INSTNO='{1}' AND HRAllocSerNo = '{2}'", queryCrit.Year, queryCrit.INSTNO, queryCrit.HRAllocSerNo));
         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);
         }
         TempData["HRAlloc"] = listData;
         List <CodeBase> codeBaseData = new List <CodeBase>();
         codeBaseData         = (List <CodeBase>) new MysqlDBA <CodeBase>(FunctionController.CONNSTR).getAllDataList(new CodeBase());
         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(RedirectToAction("Index", "HRAdd", null));
 }
示例#6
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));
        }