Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        private void render()
        {
            this.ViewData["currentUser"] = Function.GetCurrentUser();

            stperiodBll      periodBll    = new stperiodBll();
            List <tstperiod> lstPeriodMdl = periodBll.GetPeriodByStatus(HRMS_Period_Status.Open.ToString());
            StringBuilder    builder      = new StringBuilder();

            if (lstPeriodMdl.Count <= 0)
            {
                string from = "19000101";
                string to   = "19000101";
                builder.Append("{");
                builder.Append("fullPeriod:\"").Append("1900").Append("01").Append("\",");
                builder.Append("year:\"").Append("1900").Append("\",");
                builder.Append("period:\"").Append("01").Append("\",");
                builder.Append("start:\"").Append(from).Append("\",");
                builder.Append("end:\"").Append(to).Append("\"");
                builder.Append("}");
            }
            else
            {
                string from = lstPeriodMdl[0].pest.ToString("yyyyMMdd");
                string to   = lstPeriodMdl[0].peen.ToString("yyyyMMdd");
                builder.Append("{");
                builder.Append("fullPeriod:\"").Append(lstPeriodMdl[0].year).Append(lstPeriodMdl[0].mnth).Append("\",");
                builder.Append("year:\"").Append(lstPeriodMdl[0].year).Append("\",");
                builder.Append("month:\"").Append(lstPeriodMdl[0].mnth).Append("\",");
                builder.Append("start:\"").Append(from).Append("\",");
                builder.Append("end:\"").Append(to).Append("\"");
                builder.Append("}");
            }
            this.ViewData["currentPeriod"] = builder.ToString();
        }
Exemplo n.º 4
0
        //public void delete()
        //{
        //    string msg = string.Empty;
        //    try
        //    {
        //        PeriodBll periodBll = new PeriodBll();
        //        string year = Request.Form["Year"];
        //        string period = Request.Form["Period"];
        //        Exception_ErrorMessage error = periodBll.DeletePeriod(year, period);
        //        if (error == Exception_ErrorMessage.NoError)
        //        {
        //            msg = "{status:'success',msg:'" + HRMSRes.Public_Message_DeleteWell + "'}";
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        msg = "{status:'failure',msg:'" + HRMSRes.Public_Message_DeleteBad + "'}";
        //    }
        //    Response.Output.Write(msg);
        //}

        public void list()
        {
            string message = string.Empty;

            try
            {
                string record   = this.Request["record"];
                string startStr = this.Request["start"];
                string limitStr = this.Request["limit"];

                if ((record == null) || (record.Length < 1))
                {
                    record = "{\"year\":\"" + UtilDatetime.FormatDate3(DateTime.Now).Substring(0, 4) + "\"}";
                }
                Hashtable ht    = JavaScriptConvert.DeserializeObject <Hashtable>(record);
                int       start = 0;
                if (startStr != null)
                {
                    start = Convert.ToInt32(startStr);
                }

                int limit = 0;
                if (limitStr != null)
                {
                    limit = Convert.ToInt32(limitStr);
                }

                stperiodBll bll = new stperiodBll();

                List <ColumnInfo> parameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "year", ColumnValue = ht["year"].ToString()
                    }
                };

                int total = 0;
                List <tstperiod> periodList = bll.GetSelectedRecords <tstperiod>(parameters, true, start, start + limit, ref total);

                string json = JavaScriptConvert.SerializeObject(periodList);
                json = "{results:" + total + ",rows:" + json + "}";
                Response.Write(json);
            }
            catch (Exception ex)
            {
                message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}";
                Response.Output.Write(message);
            }
        }
Exemplo n.º 5
0
        public void listAllPeriod()
        {
            try
            {
                stperiodBll      bll        = new stperiodBll();
                List <tstperiod> periodList = bll.GetAllPeriods();
                string           json       = JavaScriptConvert.SerializeObject(periodList);
                json = "{results:" + periodList.Count + ",rows:" + json + "}";

                Response.Output.Write(json);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
        public void exportExcel()
        {
            string message = string.Empty;

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

                if ((record == null) || (record.Length < 1))
                {
                    record = "{\"year\":\"" + UtilDatetime.FormatDate3(DateTime.Now).Substring(0, 4) + "\"}";
                }

                if (header == null || header.Equals(string.Empty))
                {
                    return;
                }
                Hashtable         ht      = JavaScriptConvert.DeserializeObject <Hashtable>(record);
                List <ColumnInfo> headers = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(header);
                stperiodBll       bll     = new stperiodBll();

                List <ColumnInfo> parameters = new List <ColumnInfo>()
                {
                    new ColumnInfo()
                    {
                        ColumnName = "year", ColumnValue = ht["year"].ToString()
                    }
                };

                List <tstperiod> yearList = bll.GetSelectedRecords <tstperiod>(parameters);
                if (yearList != null)
                {
                    UtilExcel.ExportToExcel(Response, this.GetType().Name.GetPageName(), headers, yearList);
                }
            }
            catch (Exception ex)
            {
                message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_ExportExcelFail, ex, true) + "'}";
                Response.Output.Write(message);
            }
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
 public void listPeriodYear()
 {
     try
     {
         stperiodBll   bll      = new stperiodBll();
         List <string> yearList = bll.GetYearList();
         StringBuilder json     = new StringBuilder();
         for (int i = 0; i < yearList.Count; i++)
         {
             if (!json.ToString().Equals(""))
             {
                 json.Append(",");
             }
             json.Append("{year:'" + yearList[i] + "'}");
         }
         Response.Output.Write("{results:" + yearList.Count + ",rows:[" + json.ToString() + "]}");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }