예제 #1
0
        public tstperiod GetPreviousPeriod(tstperiod _periodMdl)
        {
            try
            {
                DateTime dt = (new DateTime(Int16.Parse(_periodMdl.year), Int16.Parse(_periodMdl.perd), 1)).AddMonths(-1);

                List <ColumnInfo> parameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "period", ColumnValue = (dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0'))
                    }
                };

                tstperiod prevMdl = GetSelectedObject <tstperiod>(parameters);

                return(prevMdl);
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
        }
예제 #2
0
        public void openPeriod()
        {
            string message = string.Empty;

            try
            {
                string record = this.Request["record"];

                Hashtable ht = JavaScriptConvert.DeserializeObject <Hashtable>(record);

                //string year = ht["year"].ToString();
                string period = ht["perd"].ToString();

                stperiodBll bll       = new stperiodBll();
                tstperiod   periodMdl = bll.GetPeriod(period);

                Exception_ErrorMessage result = bll.OpenPeriod(periodMdl);

                if (result.Equals(Exception_ErrorMessage.NoError))
                {
                    message = "{status:'success',msg:'" + HRMSRes.Public_Message_OpenPeriodSuccess + "'}";
                }
            }
            catch (Exception ex)
            {
                message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_OpenPeriodFail, ex, true) + "'}";
            }
            Response.Output.Write(message);
        }
예제 #3
0
        public Exception_ErrorMessage UpdatePeriod(tstperiod _periodMdl)
        {
            try
            {
                List <ColumnInfo> parameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "perd", ColumnValue = _periodMdl.perd
                    }
                };

                DoUpdate <tstperiod>(_periodMdl, parameters);

                return(Exception_ErrorMessage.NoError);
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
            finally
            {
            }
        }
예제 #4
0
        public Exception_ErrorMessage ClosePeriod(tstperiod _periodMdl)
        {
            try
            {
                _periodMdl.csby = Function.GetCurrentUser();
                _periodMdl.cstm = DateTime.Now;
                _periodMdl.psts = HRMS_Period_Status.Closed.ToString();
                _periodMdl.remk = " [Closed by " + _periodMdl.csby + " at " + UtilDatetime.FormateDateTime1(_periodMdl.cstm) + "]";

                List <ColumnInfo> parameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "perd", ColumnValue = _periodMdl.perd
                    }
                };

                DoUpdate <tstperiod>(_periodMdl, parameters);

                return(Exception_ErrorMessage.NoError);
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
            finally
            {
            }
        }
예제 #5
0
        public void checkPeriodStatusOnly()
        {
            string message = string.Empty;

            try
            {
                string      record    = this.Request["record"];
                Hashtable   ht        = JavaScriptConvert.DeserializeObject <Hashtable>(record);
                stperiodBll periodBll = new stperiodBll();
                tstperiod   periodMdl = periodBll.GetPeriod(ht["period"].ToString());

                periodBll.CheckSelectedPeriodStatus(periodMdl);

                message = "{status:'success',msg:'" + HRMSRes.Public_Message_CheckPeriodStatusSuccess + "'}";
            }
            catch (UtilException ex)
            {
                if ((ex.Code == (int)Exception_ErrorMessage.PeriodIsUnused) ||
                    (ex.Code == (int)Exception_ErrorMessage.StepIsCompleted))
                {
                    message = "{status:'ask',msg:'" + ExceptionPaser.Parse(ex, true) + "'}";
                }
                else
                {
                    message = "{status:'fail',msg:'" + ExceptionPaser.Parse(ex, true) + "'}";
                }
            }
            catch (Exception ex)
            {
                message = "{status:'fail',msg:'" + ExceptionPaser.Parse(ex, true) + "'}";
            }

            Response.Output.Write(message);
        }
예제 #6
0
        public void CheckPeriodStatus(tstperiod periodMdl)
        {
            HRMS_Period_Status value = (HRMS_Period_Status)Enum.Parse(typeof(HRMS_Period_Status), periodMdl.psts);

            switch (value)
            {
            case HRMS_Period_Status.Open:
                break;

            case HRMS_Period_Status.Closed:
                throw new UtilException("Period is Closed.", Exception_ErrorMessage.PeriodIsClosed, null, Exception_ExceptionSeverity.High);

            case HRMS_Period_Status.Unused:
                throw new UtilException("Period is Unused.", Exception_ErrorMessage.PeriodIsUnused, null, Exception_ExceptionSeverity.Medium);

            default:
                break;
            }
        }
예제 #7
0
        public Exception_ErrorMessage OpenPeriod(tstperiod _periodMdl)
        {
            try
            {
                //check before open
                List <tstperiod> lstPeriod = GetPeriodByStatus(HRMS_Period_Status.Open.ToString());


                if (lstPeriod.Count > 0)
                {
                    throw new UtilException(lstPeriod[0].perd, Exception_ErrorMessage.OpenPeriodFoundOpenDenied, null);
                }

                _periodMdl.csby = Function.GetCurrentUser();
                _periodMdl.cstm = DateTime.Now;
                _periodMdl.psts = HRMS_Period_Status.Open.ToString();
                _periodMdl.remk = " [Open by " + _periodMdl.csby + " at " + UtilDatetime.FormateDateTime1(_periodMdl.cstm) + "]";

                List <ColumnInfo> parameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "perd", ColumnValue = _periodMdl.perd
                    }
                };

                DoUpdate <tstperiod>(_periodMdl, parameters);

                return(Exception_ErrorMessage.NoError);
            }
            catch (UtilException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new UtilException(ex.Message, ex);
            }
            finally
            {
            }
        }
예제 #8
0
        public void edit()
        {
            string msg = string.Empty;

            try
            {
                stperiodBll            stperiodBll = new stperiodBll();
                string                 request     = Request.Form["record"];
                tstperiod              stperiodMdl = JavaScriptConvert.DeserializeObject <tstperiod>(request);
                Exception_ErrorMessage error       = stperiodBll.UpdatePeriod(stperiodMdl);
                if (error == Exception_ErrorMessage.NoError)
                {
                    msg = "{status:'success',msg:'" + HRMSRes.Public_Message_EditWell + "'}";
                }
            }
            catch (Exception ex)
            {
                msg = "{status:'failure',msg:'" + HRMSRes.Public_Message_EditBad + "'}";
            }

            Response.Output.Write(msg);
        }