예제 #1
0
        public static string Tlanguage(int id)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var    language = db1.languages.Where(x => x.ID == id).FirstOrDefault();
            string lname    = language.Lang_Name.ToString();

            switch (lname)
            {
            case "French":
            {
                lname = "français";
                break;
            }

            case "Spanish":
            {
                lname = "español";
                break;
            }

            default:
            {
                break;
            }
            }
            return(lname);
        }
예제 #2
0
        public static string Olanguage1(int id)
        {
            gdgs1Entities db1      = new gdgs1Entities();
            var           language = db1.olanguages.Where(x => x.ID == id).FirstOrDefault();
            string        lname    = language.Name.ToString();

            return(lname);
        }
예제 #3
0
        public static string getSym(int CAt)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var    tempx = db1.final_temp.Where(x => x.categories_ID == CAt).FirstOrDefault();
            string sym   = tempx.Symbole.ToString();

            return(sym);
        }
예제 #4
0
        public ActionResult FindTemplate(JIUViewModel model)
        {
            gdgs1Entities db1      = new gdgs1Entities();
            JIUViewModel  Newmodel = new JIUViewModel();
            //Filtering possible Matches according to Symbole structure
            string sym   = model.Sym.ToString();
            int    Count = sym.Split('/').Count();
            int    i     = 0;
            int    index = 0;

            int numofmatches = 0;
            //string Matches ="";


            List <JIUViewModel> List = new List <JIUViewModel>();

            List = db1.final_temp.Where(p => p.Count == Count).Select(Item => new JIUViewModel
            {
                tempname  = Item.Name,
                structure = Item.Symbole,
                regx      = Item.Reg,
            }).ToList();

            foreach (var l in List)
            {
                var pattern = new Regex(@l.regx.ToString());
                if (pattern.IsMatch(sym.ToString()))
                {
                    index        = i;
                    numofmatches = numofmatches + 1;
                }
                i++;
            }
            if (numofmatches > 1)
            {
                string s = List[index].structure.ToString();
                model.structure = s;

                return(RedirectToAction("Verify", model));
            }
            if (numofmatches == 1)
            {
                string x  = List[index].tempname.ToString();
                string xx = List[index].structure.ToString();
                model.structure = xx;
                model.tempname  = x;
                var    lang = db1.languages.Where(p => p.ID == model.lang_ID).FirstOrDefault();
                string name = lang.Lang_Name.ToString().Substring(0, 1);
                model.tempname = model.tempname + name;
                return(RedirectToAction("Generate", model));
            }

            else
            {
                return(RedirectToAction("WrongTemplate"));
            }
        }
예제 #5
0
        public static string getCount(string iso, UnogViewModel model)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var    count = db1.countries.Where(x => x.languages_ID == model.lang_ID && x.ISO == iso).FirstOrDefault();
            string Cname = count.Short_Name.ToString();

            return(Cname);
        }
예제 #6
0
        public static string getDist(UnogViewModel model)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var    item = db1.distrbutions.FirstOrDefault(p => p.ID.ToString() == model.dist);
            string dist = item.Name.ToString();

            return(dist);
        }
예제 #7
0
        public static string getCat(int id)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var    item  = db1.categories.FirstOrDefault(p => p.ID == id);
            string final = item.Name.ToString();

            return(final);
        }
예제 #8
0
        public static string getlanguageQR(int id)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var    count = db1.languages.Where(x => x.ID == id).FirstOrDefault();
            string Cname = count.Lang_Name.ToString();

            Cname = Cname.Substring(0, 1);
            return(Cname);
        }
예제 #9
0
        public static string[] info(SRViewModel model)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var item  = db1.categories.FirstOrDefault(p => p.ID == model.Cat);
            var item1 = db1.doc_type.FirstOrDefault(p => p.ID == item.type_ID);
            var item2 = db1.committees.FirstOrDefault(p => p.ID == item1.committee_ID);

            string[] info = new string[3];
            info[0] = item.Name.ToString();
            info[1] = item1.Name.ToString();
            info[2] = item2.Name.ToString();
            return(info);
        }
예제 #10
0
        public static string TempName(ECEViewModel model)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            if (model.SCat == "Not Applicable" && model.cpr == false)
            {
                var temp = db1.final_temp.Where(a => a.categories_ID == model.Cat).FirstOrDefault();
                if (temp == null)
                {
                    return("Wrong Template");
                }
                else
                {
                    string lang = language(model.lang_ID);
                    lang = lang.Substring(0, 1);
                    string tempname = temp.Name.ToString() + lang;
                    return(tempname);
                }
            }
            else if (model.SCat != "Not Applicable" && model.cpr == false)
            {
                var temp = db1.final_temp.Where(a => a.categories_ID == model.Cat && a.Title == model.SCat).FirstOrDefault();
                if (temp == null)
                {
                    return("Wrong Template");
                }
                else
                {
                    string lang = language(model.lang_ID);
                    lang = lang.Substring(0, 1);
                    string tempname = temp.Name.ToString() + lang;
                    return(tempname);
                }
            }
            else if (model.cpr == true && String.IsNullOrEmpty(model.cprnum))
            {
                return("Wrong Template crp");
            }
            else
            {
                string lang = language(model.lang_ID);
                lang = lang.Substring(0, 1);
                string tempname = "ITCCRP" + lang;
                return(tempname);
            }
        }
예제 #11
0
        public static string getSym(ECEViewModel model)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            if (model.SCat == "Not Applicable")
            {
                var    item = db1.final_temp.FirstOrDefault(p => p.categories_ID == model.Cat && p.Title == model.SCat);
                string sym  = item.Symbole.ToString();
                return(sym);
            }
            else
            {
                var    item = db1.final_temp.FirstOrDefault(p => p.categories_ID == model.Cat && p.Title == model.SCat);
                string sym  = item.Symbole.ToString();
                return(sym);
            }
        }
예제 #12
0
        public static string distrb(int CAt)
        {
            gdgs1Entities db1   = new gdgs1Entities();
            string        dist  = "";
            var           tempx = db1.categories.Where(x => x.ID == CAt).FirstOrDefault();

            string cat = tempx.Name.ToString();

            if (cat == "Public")
            {
                dist = "General";
            }
            if (cat == "Closed")
            {
                dist = "Restricted*";
            }
            return(dist);
        }
예제 #13
0
        public static bool categoryname(UnogViewModel model)
        {
            string str = model.tempname.ToString();
            //str = str.Substring(0, str.Length-1);
            gdgs1Entities db1   = new gdgs1Entities();
            var           item  = db1.final_temp.FirstOrDefault(p => p.Name == str);
            int           x     = item.categories_ID;
            var           item1 = db1.categories.FirstOrDefault(p => p.ID == x);
            string        cat   = item1.Name.ToString();

            if (cat == "Country Report" || cat == "Country Report -Optional Procedure")
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #14
0
        public static string formatdate(string date, SRViewModel model)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var item = db1.languages.FirstOrDefault(p => p.ID == model.lang_ID);
            // string lang = item.Lang_Name.ToString();

            string final = "day month year";

            //if (lang == "French")
            //{
            //    string[] d = date.Split('/');
            //    int[] convert = Array.ConvertAll<string, int>(d, int.Parse);
            //    var frenchCultureInfo = CultureInfo.CreateSpecificCulture("fr-fr");
            //    string month = frenchCultureInfo.DateTimeFormat.GetMonthName(convert[0]);
            //    if (d[1] == "1")
            //    {
            //        d[1] = d[1] + "\u1D49" + "\u02B3";
            //    }
            //    final = d[1] + " " + month + " " + d[2];
            //}
            //else if (lang == "Spanish")
            //{
            //    string[] d = date.Split('/');
            //    int[] convert = Array.ConvertAll<string, int>(d, int.Parse);
            //    var frenchCultureInfo = CultureInfo.CreateSpecificCulture("es-es");
            //    string month = frenchCultureInfo.DateTimeFormat.GetMonthName(convert[0]);
            //    final = d[1] + " de " + month + " de " + d[2];
            //}
            //else
            //{
            string[] d                 = date.Split('/');
            int[]    convert           = Array.ConvertAll <string, int>(d, int.Parse);
            var      frenchCultureInfo = CultureInfo.CreateSpecificCulture("en-US");
            string   month             = frenchCultureInfo.DateTimeFormat.GetMonthName(convert[1]);

            final = d[0] + " " + month + " " + d[2];
            //}
            return(final);
        }
예제 #15
0
        public ActionResult FindTemplate(SRViewModel model)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            //Filtering possible Matches according to Symbole structure
            var    temp     = db.final_temp.Where(x => x.categories_ID == model.Cat).FirstOrDefault();
            string tempname = temp.Name.ToString();

            // var langtemp = db.languages.Where(x => x.ID == model.lang_ID).FirstOrDefault();
            //  string lang = langtemp.Lang_Name.ToString();
            // model.temp = tempname + lang[0].ToString();
            if (model.RC == false)
            {
                model.temp = tempname + "E";
            }
            if (model.RC == true)
            {
                model.temp = tempname + "RE";
            }

            return(RedirectToAction("Generate", model));
        }
예제 #16
0
        public static string Reportnumber(UnogViewModel model, string prep, int langg, string iso)
        {
            gdgs1Entities db1 = new gdgs1Entities();

            var    item = db1.languages.Where(p => p.ID == langg).FirstOrDefault();
            string lang = item.Lang_Name.ToString();

            string final    = "";
            string country  = getCount(iso, model);
            string Country1 = getCountwithSrticle(iso, model);
            bool   cat      = false;

            cat = categoryname(model);
            if (cat == true)
            {
                switch (lang)
                {
                case "English":
                {
                    string   cc  = prep;
                    string[] com = cc.Split('-');

                    //case single number
                    if (com.Length == 1)
                    {
                        var engCultureInfo = CultureInfo.CreateSpecificCulture("en-US");
                        int x = Convert.ToInt32(prep);
                        final = x.ToOrdinalWords(engCultureInfo);
                        if (final == "first")
                        {
                            final = "initial report of " + country;
                        }
                        else
                        {
                            final = final + " periodic report of " + country;
                        }
                    }

                    //case combined number
                    if (com.Length > 1)
                    {
                        var    engCultureInfo = CultureInfo.CreateSpecificCulture("en-US");
                        int    x      = Convert.ToInt32(com[0]);
                        int    y      = Convert.ToInt32(com[1]);
                        string Fprep1 = x.ToOrdinalWords(engCultureInfo);
                        string Fprep2 = y.ToOrdinalWords(engCultureInfo);
                        //case 4 and 5 or 5 and 6
                        if (x == y - 1)
                        {
                            if (Fprep1 == "first")
                            {
                                Fprep1 = "initial ";
                                final  = Fprep1 + "and " + Fprep2 + " combined reports of " + country;
                            }
                            else
                            {
                                final = Fprep1 + " and " + Fprep2 + " combined reports of " + country;
                            }
                        }
                        //case 1 - 5 or 3-10
                        if (x != y - 1)
                        {
                            if (Fprep1 == "first")
                            {
                                Fprep1 = "initial ";
                                final  = Fprep1 + " to " + Fprep2 + " combined reports of " + country;
                            }
                            else
                            {
                                final = Fprep1 + " to " + Fprep2 + " combined reports of" + country;
                            }
                        }
                    }
                    break;
                }

                case "French":
                {
                    string   cc  = prep;
                    string[] com = cc.Split('-');
                    var      frenchCultureInfo = CultureInfo.CreateSpecificCulture("fr-fr");

                    //case single number
                    if (com.Length == 1)
                    {
                        int x = Convert.ToInt32(prep);
                        final = x.ToOrdinalWords(frenchCultureInfo);
                        if (final == "premier")
                        {
                            final = "rapport initial " + Country1;
                        }
                        else
                        {
                            final = final + " rapport périodique " + Country1;
                        }
                    }
                    //case combined number
                    if (com.Length > 1)
                    {
                        int    x      = Convert.ToInt32(com[0]);
                        int    y      = Convert.ToInt32(com[1]);
                        string Fprep1 = x.ToOrdinalWords(frenchCultureInfo);
                        string Fprep2 = y.ToOrdinalWords(frenchCultureInfo);
                        //case 4 and 5 or 5 and 6


                        if (Fprep1 == "premier")
                        {
                            Fprep1 = "rapport initial";
                            final  = "rapport " + Country1 + " valant " + Fprep1 + " à " + Fprep2 + " rapports périodiques";
                        }
                        else
                        {
                            final = "rapport " + Country1 + " valant " + Fprep1 + " à " + Fprep2 + " rapports périodiques";
                        }
                    }
                    break;
                }

                case "Spanish":
                {
                    final = SpanishNum(model, prep, iso);

                    break;
                }
                }
            }
            if (cat == false)
            {
                switch (lang)
                {
                case "English":
                {
                    string   cc  = prep;
                    string[] com = cc.Split('-');

                    //case single number
                    if (com.Length == 1)
                    {
                        var engCultureInfo = CultureInfo.CreateSpecificCulture("en-US");
                        int x = Convert.ToInt32(prep);
                        final = x.ToOrdinalWords(engCultureInfo);
                        final = final.Substring(0, 1).ToUpperInvariant() + final.Substring(1);
                        if (final == "First")
                        {
                            final = "Initial report ";
                        }
                        else
                        {
                            final = final + " periodic report ";
                        }
                    }

                    //case combined number
                    if (com.Length > 1)
                    {
                        int    x      = Convert.ToInt32(com[0]);
                        int    y      = Convert.ToInt32(com[1]);
                        string Fprep1 = x.ToOrdinalWords();
                        string Fprep2 = y.ToOrdinalWords();
                        //case 4 and 5 or 5 and 6
                        if (x == y - 1)
                        {
                            if (Fprep1 == "first")
                            {
                                Fprep1 = "Initial ";
                                final  = Fprep1 + "and " + Fprep2 + " combined reports ";
                            }
                            else
                            {
                                Fprep1 = Fprep1 + " and " + Fprep2 + " combined reports ";
                            }
                        }
                        //case 1 - 5 or 3-10
                        if (x != y - 1)
                        {
                            if (Fprep1 == "first")
                            {
                                Fprep1 = "Initial ";
                                final  = Fprep1 + "- " + Fprep2 + " combined reports";
                            }
                            else
                            {
                                Fprep1 = Fprep1 + " - " + Fprep2 + " combined reports ";
                            }
                        }
                    }
                    break;
                }

                case "French":
                {
                    string   cc  = prep;
                    string[] com = cc.Split('-');
                    var      frenchCultureInfo = CultureInfo.CreateSpecificCulture("fr-fr");

                    //case single number
                    if (com.Length == 1)
                    {
                        int x = Convert.ToInt32(prep);
                        final = x.ToOrdinalWords(frenchCultureInfo);
                        final = final.Substring(0, 1).ToUpper() + final.Substring(1);
                        if (final == "Premier")
                        {
                            final = "Rapport initiaux ";
                        }
                        else
                        {
                            final = final + " rapport périodique ";
                        }
                    }
                    //case combined number
                    if (com.Length > 1)
                    {
                        int    x      = Convert.ToInt32(com[0]);
                        int    y      = Convert.ToInt32(com[1]);
                        string Fprep1 = x.ToOrdinalWords(frenchCultureInfo);
                        string Fprep2 = y.ToOrdinalWords(frenchCultureInfo);
                        //case 4 and 5 or 5 and 6


                        if (Fprep1 == "premier")
                        {
                            Fprep1 = "initial ";
                            final  = "Rapport valant " + Fprep1 + " à " + Fprep2 + " rapports périodiques";
                        }
                        else
                        {
                            final = "Rapport valant " + Fprep1 + " à " + Fprep2 + " rapports périodiques";
                        }
                    }
                    break;
                }

                case "Spanish":
                {
                    final = SpanishNum1(model, prep, iso);

                    break;
                }
                }
            }
            return(final);
        }