Пример #1
0
        public NoSeriesManagement(NoSeries noSeries)
        {
            objNoSeries = noSeries;

            //string testvalue = "010";
            //int tempValue = int.Parse(testvalue) + 1;
            //string newValue = tempValue.ToString("000");
        }
Пример #2
0
        public string UpdateNoSeries(string str, string Code)
        {
            NoSeries ns = _context.NoSeries.SingleOrDefault(v => v.Code == Code);

            ns.LastNoUsed  = str;
            ns.DateUpdated = DateTime.Now;
            _context.SaveChanges();
            return("Ok");
        }
Пример #3
0
        public string SetDefaultSeries(string NoSeriesCode)
        {
            NoSeries noSeries = RetrieveNoSeriesByCode(NoSeriesCode);

            if (noSeries.NoSeriesDefaultNos == 1)
            {
                return(noSeries.NoSeriesCode);
            }
            else
            {
                return("");
            }
        }
Пример #4
0
 public Boolean TestManual(string DefaultNoSeriesCode)
 {
     if (DefaultNoSeriesCode != "")
     {
         objNoSeries = RetrieveNoSeriesByCode(DefaultNoSeriesCode);
         if (objNoSeries.NoSeriesManualNos == 0)
         {
             return(false);
         }
         return(true);
     }
     return(false);
 }
Пример #5
0
        public string GetNoSeries(string Code)
        {
            string str    = "";
            int    number = 0;

            try
            {
                //new setup for num series
                string lno = _context.NoSeries.Where(i => i.Code == Code).Select(n => n.LastNoUsed).FirstOrDefault();
                if (lno == null)
                {
                    var ns = new NoSeries
                    {
                        Code        = Code,
                        LastNoUsed  = "00000",
                        DateCreated = DateTime.Now.Date,
                        DateUpdated = DateTime.Now.Date
                    };
                    _context.Add(ns);
                    _context.SaveChanges();

                    number = 0;
                }
                else
                {
                    number = Convert.ToInt32(lno);
                }


                number += 1;

                str = number.ToString("D5");
            }
            catch (Exception e)
            {
                throw;
            }


            return(str);
        }
Пример #6
0
        public NoSeries GenerateNoSeriesObject(SqlDataReader sqlDataReader)
        {
            objNoSeries                     = new NoSeries();
            objNoSeries.NoSeriesID          = Convert.ToInt32(sqlDataReader["NoSeriesID"]);
            objNoSeries.NoSeriesCode        = sqlDataReader["NoSeriesCode"].ToString();
            objNoSeries.NoSeriesDescription = sqlDataReader["NoSeriesDescription"].ToString();
            objNoSeries.NoSeriesDefaultNos  = Convert.ToByte(sqlDataReader["NoSeriesDefaultNos"]);
            objNoSeries.NoSeriesManualNos   = Convert.ToByte(sqlDataReader["NoSeriesManualNos"]);
            objNoSeries.NoSeriesDateOrder   = Convert.ToByte(sqlDataReader["NoSeriesDateOrder"]);
            objNoSeries.DistLocationPrefix  = Convert.ToByte(sqlDataReader["DistLocationPrefix"]);

            objNoSeries.RowStatus = (short)sqlDataReader["RowStatus"];
            objNoSeries.CreatedBy = sqlDataReader["CreatedBy"].ToString();
            if (sqlDataReader["CreatedTime"] != null && sqlDataReader["CreatedTime"].ToString() != "")
            {
                objNoSeries.CreatedTime = Convert.ToDateTime(sqlDataReader["CreatedTime"]);
            }
            objNoSeries.LastModifiedBy = sqlDataReader["LastModifiedBy"].ToString();
            if (sqlDataReader["LastModifiedTime"] != null && sqlDataReader["LastModifiedTime"].ToString() != "")
            {
                objNoSeries.LastModifiedTime = Convert.ToDateTime(sqlDataReader["LastModifiedTime"]);
            }
            return(objNoSeries);
        }
Пример #7
0
        public void InitSeries(string DefaultNoSeriesCode, string OldNoSeriesCode, DateTime?NewDate, string ManualNo, out string NewNo, out string NewNoSeriesCode)
        {
            //jika new code tidak di entry manual
            string NewNoTemp           = "";
            string NewNoSeriesCodeTemp = "";

            if (ManualNo == "")
            {
                objNoSeries = RetrieveNoSeriesByCode(DefaultNoSeriesCode);
                if (objNoSeries.NoSeriesDefaultNos == 0)
                {
                    strError = "bukan default no";
                }
                if (OldNoSeriesCode != "")
                {
                    NoSeriesCode = DefaultNoSeriesCode;
                    //FilterSeries;
                    objNoSeries = RetrieveNoSeriesByCode(OldNoSeriesCode);
                    if (objNoSeries.NoSeriesID > 0)
                    {
                        objNoSeries = RetrieveNoSeriesByCode(DefaultNoSeriesCode);
                    }
                }
                NewNoTemp           = GetNextNo(objNoSeries.NoSeriesCode, NewDate, true);
                NewNoSeriesCodeTemp = objNoSeries.NoSeriesCode;
            }
            else
            if (TestManual(DefaultNoSeriesCode))
            {
                NewNoTemp           = ManualNo;
                NewNoSeriesCodeTemp = "";
            }

            NewNo           = NewNoTemp;
            NewNoSeriesCode = NewNoSeriesCodeTemp;
        }