Exemplo n.º 1
0
        public static string fifodc_three(string datecode)
        {
            string[] sArray = null;
            string   fifodc = "";

            if (datecode.Split('/').Length > 1)
            {
                sArray = datecode.Split('/');
            }
            if (datecode.Split('-').Length > 1)
            {
                sArray = datecode.Split('-');
            }
            if (datecode.Split('.').Length > 1)
            {
                sArray = datecode.Split('.');
            }
            if (sArray != null && sArray.Length > 1)
            {
                fifodc = System.DateTime.Now.ToString("yyyyMMdd");
            }
            else
            {
                if (DataCodeFunction.checkisnumber(datecode) == false)
                {
                    if (DataCodeFunction.checkisnumber(datecode.Substring(1, 2)) == true)
                    {
                        dc_week = (Convert.ToInt32(datecode.Substring(1, 2)) * 7).ToString();
                        if (Convert.ToInt32(dc_week) > 365)
                        {
                            dc_week = "365";
                        }
                        // fifodc = refWcfMtr_Business.Instance.Getdate_dc(System.DateTime.Now.ToString("yyyy") + dc_week);
                        fifodc = Getdate_dc(DateTime.Now.ToString("yyyy"), dc_week);
                    }
                }
                else
                {
                    fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                }
            }
            if (Convert.ToInt32(fifodc) > Convert.ToInt32(System.DateTime.Now.ToString("yyyyMMdd")))
            {
                fifodc = System.DateTime.Now.ToString("yyyyMMdd");
            }
            return(fifodc);
        }
Exemplo n.º 2
0
        public static string fifodc_five(string datecode)
        {
            string[] sArray = null;
            string   fifodc = "";

            if (datecode.Split('/').Length > 1)
            {
                sArray = datecode.Split('/');
            }
            if (datecode.Split('-').Length > 1)
            {
                sArray = datecode.Split('-');
            }
            if (datecode.Split('.').Length > 1)
            {
                sArray = datecode.Split('.');
            }
            if (sArray != null && sArray.Length > 1)
            {
                for (int i = 0; i < sArray.Length; i++)
                {
                    if (DataCodeFunction.checkisnumber(sArray[i]) == false)
                    {
                        fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                        break;
                    }
                }
                if (string.IsNullOrEmpty(fifodc))
                {
                    switch (sArray.Length)
                    {
                    case 2:
                        dc_week = (Convert.ToInt32(sArray[1]) * 7).ToString();
                        if (Convert.ToInt32(dc_week) > 365)
                        {
                            dc_week = "365";
                        }
                        // fifodc = refWcfMtr_Business.Instance.Getdate_dc("20" + sArray[0] + dc_week);
                        fifodc = Getdate_dc("20" + sArray[0], dc_week);
                        break;

                    default:
                        fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                        break;
                    }
                }
            }
            else
            {
                if (DataCodeFunction.checkisnumber(datecode) == false)
                {
                    if (DataCodeFunction.checkisnumber(datecode.Substring(1, 4)) == false)
                    {
                        if (DataCodeFunction.checkisnumber(datecode.Substring(0, 4)) == false)
                        {
                            fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                        }
                        else
                        {
                            dc_week = (Convert.ToInt32(datecode.Substring(2, 2)) * 7).ToString();
                            if (Convert.ToInt32(dc_week) > 365)
                            {
                                dc_week = "365";
                            }
                            //fifodc = refWcfMtr_Business.Instance.Getdate_dc("20" + datecode.Substring(0, 2) + dc_week);
                            fifodc = Getdate_dc("20" + datecode.Substring(0, 2), dc_week);
                        }
                    }
                    else
                    {
                        dc_week = (Convert.ToInt32(datecode.Substring(3, 2)) * 7).ToString();
                        if (Convert.ToInt32(dc_week) > 365)
                        {
                            dc_week = "365";
                        }
                        //fifodc = refWcfMtr_Business.Instance.Getdate_dc("20" + datecode.Substring(1, 2) + dc_week);
                        fifodc = Getdate_dc("20" + datecode.Substring(1, 2), dc_week);
                    }
                }
                else
                {
                    fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                }
            }
            if (Convert.ToInt32(fifodc) > Convert.ToInt32(System.DateTime.Now.ToString("yyyyMMdd")))
            {
                fifodc = System.DateTime.Now.ToString("yyyyMMdd");
            }
            return(fifodc);
        }
Exemplo n.º 3
0
        public static string fifodc_ten(string datecode)
        {
            string[] sArray = null;
            string   fifodc = "";

            if (datecode.Split('/').Length > 1)
            {
                sArray = datecode.Split('/');
            }
            if (datecode.Split('-').Length > 1)
            {
                sArray = datecode.Split('-');
            }
            if (datecode.Split('.').Length > 1)
            {
                sArray = datecode.Split('.');
            }
            if (sArray != null && sArray.Length > 1 && sArray.Length == 3)
            {
                for (int i = 0; i < sArray.Length; i++)
                {
                    if (DataCodeFunction.checkisnumber(sArray[i]) == false)
                    {
                        fifodc = fifo_mm(sArray[i].ToUpper());
                        if (!string.IsNullOrEmpty(fifodc))
                        {
                            if (sArray.Length == 3)
                            {
                                fifodc = sArray[0] + fifodc + sArray[2].PadLeft(2, '0');
                            }
                            else if (sArray.Length == 2)
                            {
                                fifodc = sArray[0] + fifodc + "30";
                            }
                            else
                            {
                                fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                            }
                        }
                        else
                        {
                            fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                        }
                        break;
                    }
                }
                if (string.IsNullOrEmpty(fifodc))
                {
                    if (sArray[0].Length == 2 && sArray[2].Length == 4 && Convert.ToInt32(sArray[0]) < 13)
                    {
                        fifodc = sArray[2] + sArray[0] + sArray[1];
                    }
                    else if (sArray[0].Length == 4 && sArray[1].Length == 2 && Convert.ToInt32(sArray[1]) < 13)
                    {
                        fifodc = sArray[0] + sArray[1] + sArray[2];
                    }
                    else if (sArray[0].Length == 2 && sArray[2].Length == 4 && Convert.ToInt32(sArray[1]) < 13)
                    {
                        fifodc = sArray[2] + sArray[1] + sArray[0];
                    }
                    else
                    {
                        fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                    }
                    if (Convert.ToInt32(fifodc) > Convert.ToInt32(System.DateTime.Now.ToString("yyyyMMdd")))
                    {
                        fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                    }
                }
            }
            else
            {
                fifodc = System.DateTime.Now.ToString("yyyyMMdd");
            }
            return(fifodc);
        }
Exemplo n.º 4
0
        public static string fifodc_six(string datecode)
        {
            string[] sArray = null;
            string   fifodc = "";

            if (datecode.Split('/').Length > 1)
            {
                sArray = datecode.Split('/');
            }
            if (datecode.Split('-').Length > 1)
            {
                sArray = datecode.Split('-');
            }
            if (datecode.Split('.').Length > 1)
            {
                sArray = datecode.Split('.');
            }
            if (sArray != null && sArray.Length > 1)
            {
                for (int i = 0; i < sArray.Length; i++)
                {
                    if (DataCodeFunction.checkisnumber(sArray[i]) == false)
                    {
                        fifodc = fifo_mm(sArray[i].ToUpper());
                        if (!string.IsNullOrEmpty(fifodc))
                        {
                            if (sArray.Length == 2 && sArray[0].Length == 2)
                            {
                                fifodc = "20" + sArray[0] + fifodc + "30";
                            }
                            else
                            {
                                fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                            }
                        }
                        else
                        {
                            fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                        }
                        break;
                    }
                }
                if (string.IsNullOrEmpty(fifodc))
                {
                    switch (sArray.Length)
                    {
                    case 3:
                        fifodc = "20" + sArray[0] + sArray[1].PadLeft(2, '0') + sArray[2].PadLeft(2, '0');
                        break;

                    default:
                        fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                        break;
                    }
                }
            }
            else
            {
                if (DataCodeFunction.checkisnumber(datecode) == false)
                {
                    if (DataCodeFunction.checkisnumber(datecode.Substring(1, 4)) == false)
                    {
                        fifodc = System.DateTime.Now.ToString("yyyyMMdd");
                    }
                    else
                    {
                        dc_week = (Convert.ToInt32(datecode.Substring(3, 2)) * 7).ToString();
                        if (Convert.ToInt32(dc_week) > 365)
                        {
                            dc_week = "365";
                        }
                        //  fifodc = refWcfMtr_Business.Instance.Getdate_dc("20" + datecode.Substring(1, 2) + dc_week);
                        fifodc = Getdate_dc("20" + datecode.Substring(1, 2), dc_week);
                    }
                }
                else
                {
                    if (datecode.Substring(0, 4) == System.DateTime.Now.ToString("yyyy") ||
                        datecode.Substring(0, 3) == "201")
                    {
                        dc_week = (Convert.ToInt32(datecode.Substring(4, 2)) * 7).ToString();
                        if (Convert.ToInt32(dc_week) > 365)
                        {
                            dc_week = "365";
                        }
                        // fifodc = refWcfMtr_Business.Instance.Getdate_dc(datecode.Substring(0, 4) + dc_week);
                        fifodc = Getdate_dc(datecode.Substring(0, 4), dc_week);
                    }
                    else if (datecode.Substring(2, 3) == "201")
                    {
                        dc_week = (Convert.ToInt32(datecode.Substring(0, 2)) * 7).ToString();
                        if (Convert.ToInt32(dc_week) > 365)
                        {
                            dc_week = "365";
                        }
                        fifodc = Getdate_dc(datecode.Substring(2, 4), dc_week);
                        //  fifodc = refWcfMtr_Business.Instance.Getdate_dc(datecode.Substring(2, 4) + dc_week);
                    }
                    else
                    {
                        fifodc = "20" + datecode;
                    }
                }
            }
            if (Convert.ToInt32(fifodc) > Convert.ToInt32(System.DateTime.Now.ToString("yyyyMMdd")))
            {
                fifodc = System.DateTime.Now.ToString("yyyyMMdd");
            }
            return(fifodc);
        }