예제 #1
0
        public String getForm()
        {
            clsForm     form     = new clsForm();
            clsResponse response = new clsResponse();

            form          = FacadeDA.getAllGenres(form, ref response);
            form          = FacadeDA.getAllGenders(form, ref response);
            form          = FacadeDA.getAllLocations(form, ref response);
            response.Data = serializer.Serialize(form);
            return(serializer.Serialize(response));
        }
예제 #2
0
        public string getForm()
        {
            clsForm     form     = new clsForm();
            clsResponse response = new clsResponse();

            form          = FacadeDA.getAllGenres(form, ref response);
            form          = FacadeDA.getAllLocations(form, ref response);
            response.Data = serializer.Serialize(form);
            System.Diagnostics.Debug.WriteLine(serializer.Serialize(response));
            return(serializer.Serialize(response));
        }
예제 #3
0
 public clsForm getAllLocations(clsForm pclsForm, ref clsResponse pclsResponse)
 {
     try
     {
         return(FanRead.getAllLocations(pclsForm, ref pclsResponse));
     }
     catch
     {
         pclsResponse.Code    = 007;
         pclsResponse.Success = false;
         pclsResponse.Message = "Internal Error";
         return(pclsForm);//cambiar por error
     }
 }
예제 #4
0
        public static void Main()
        {
            System.Diagnostics.Stopwatch sw = Stopwatch.StartNew();
            clsFacadeDA a = new clsFacadeDA();
            clsForm     b = new clsForm();
            clsResponse c = new clsResponse();
            Serializer  j = new Serializer();
            clsInfoBand p = new clsInfoBand();

            Console.WriteLine(j.Serialize(a.getAllGenres(a.getAllGenders(b, ref c), ref c)));
            Console.WriteLine(sw.ElapsedMilliseconds);
            sw.Stop();
            Console.ReadKey();
        }
예제 #5
0
        public void GetReturnsJsonString()
        {
            clsForm form = new clsForm();

            form.genres       = new List <string>(new string[] { "Rock", "Metal", "Pop" });
            form.codGenres    = new List <int>(new int[] { 1, 2, 3 });
            form.genders      = new List <string>(new string[] { "Masculino", "Femenino" });
            form.codGenders   = new List <int>(new int[] { 1, 2, 3 });
            form.locations    = new List <string>(new string[] { "Costa Rica", "Panama", "Estados Unidos" });
            form.codLocations = new List <int>(new int[] { 1, 2, 3 });


            var _mock = new Mock <FacadeBL>();

            _mock.Setup(x => x.getFanForm()).Returns(JsonConvert.SerializeObject(form));
        }
예제 #6
0
 private static clsForm CheckNewFrm(string ttthisfrm, List <clsForm> frms, clsForm frm)
 {
     foreach (clsForm f in frms)
     {
         if (f.Form == ttthisfrm)
         {
             LogicError.Throw(eLogicError.X137);
             return(frm);
         }
     }
     //if (!clsForm.StaticForms.Contains(ttthisfrm) && ttthisfrm != "frmNewProject") {
     if (!clsForm.StaticForms.Contains(ttthisfrm))
     {
         LogicError.Throw(eLogicError.X138);
     }
     frm = new clsForm(ttthisfrm);
     frms.Add(frm);
     return(frm);
 }
예제 #7
0
        public clsForm getAllLocations(clsForm pclsForm, ref clsResponse pclsResponse)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("myFan.SP_GetAllLocations", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                conn.Open();
                SqlDataReader result = cmd.ExecuteReader();
                List <String> values = new List <String>();
                List <int>    cods   = new List <int>();
                while (result.Read())
                {
                    values.Add(result["Country"].ToString());
                    cods.Add(Convert.ToInt32(result["Locationcode"]));
                }
                pclsForm.locations    = values;
                pclsForm.codLocations = cods;
                pclsResponse.Code     = 0;
                pclsResponse.Message  = "Done";
                pclsResponse.Success  = true;
            }
            catch (SqlException ex)
            {
                pclsResponse.Code    = 1;
                pclsResponse.Message = "Error while procesing your request.";
                pclsResponse.Success = false;
            }
            catch (Exception ex)
            {
                pclsResponse.Code    = 2;
                pclsResponse.Message = "Unexpected error.";
                pclsResponse.Success = false;
            }
            finally
            {
                conn.Close();
            }

            return(pclsForm);
        }
예제 #8
0
        public clsForm getAllgenders(clsForm pclsForm, ref clsResponse pclsResponse)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("myFan.SP_ObtenerSexosHabilitados", conn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                conn.Open();
                SqlDataReader result = cmd.ExecuteReader();
                List <String> values = new List <String>();
                List <int>    cods   = new List <int>();
                while (result.Read())
                {
                    values.Add(result["strDescripcion"].ToString());
                    cods.Add(Convert.ToInt32(result["intCodSexo"]));
                }
                pclsForm.genders     = values;
                pclsForm.codGenders  = cods;
                pclsResponse.Code    = 0;
                pclsResponse.Message = "Done";
            }
            catch (SqlException ex)
            {
                pclsResponse.Code    = 1;
                pclsResponse.Success = false;
                pclsResponse.Message = "Error while procesing your request.";
            }
            catch (Exception ex)
            {
                pclsResponse.Code    = 2;
                pclsResponse.Success = false;
                pclsResponse.Message = "Unexpected error.";
            }
            finally
            {
                conn.Close();
            }


            return(pclsForm);
        }
예제 #9
0
        static clsTT()
        {
            string[] ttfrmctl;
            string   ttprevfrm = "";
            string   ttthisfrm = "";

            char[]         delimdot = new char[] { '.' };
            List <clsForm> frms     = new List <clsForm>();
            List <string>  lines    = GetLines(Cfg.ToolTipsFilePath);
            clsForm        frm      = null;
            List <string>  html     = null;

            foreach (string l in lines)
            {
                string ltrim = l.Trim();
                if (ltrim.StartsWith("$$"))
                {
                    ttfrmctl = ltrim.Split(delimdot);
                    if (ttfrmctl.Length != 2 || !ttfrmctl[1].StartsWith("$"))
                    {
                        LogicError.Throw(eLogicError.X136);
                    }
                    ttthisfrm = ttfrmctl[0].Substring(2); //omit '$$'
                    if (ttthisfrm != ttprevfrm)           //check if form already created
                    {
                        frm       = CheckNewFrm(ttthisfrm, frms, frm);
                        ttprevfrm = ttthisfrm;
                    }
                    frm.Ctrls.Add(ttfrmctl[1].Substring(1)); //omit '$'
                    html = new List <string>();
                    frm.HTML.Add(html);
                }
                else if (ltrim.StartsWith("$"))
                {
                    LogicError.Throw(eLogicError.X136);
                }
                else
                {
                    if (l != "")
                    {
                        html.Add(l);
                    }
                }
            }

            for (int i = 0; i < frms.Count; i++)
            {
                for (int j = frms[i].HTML.Count - 2; j >= 0; j--) //propagate last to first
                {
                    if (frms[i].HTML[j].Count == 0)
                    {
                        frms[i].HTML[j] = frms[i].HTML[j + 1];
                    }
                }
            }

            foreach (clsForm f in frms)
            {
                LoadStaticToolTips(frms, f);
            }
        }
예제 #10
0
 public clsForm getAllGenders(clsForm pclsForm, ref clsResponse pclsResponse)
 {
     return(FanDA.getAllGenders(pclsForm, ref pclsResponse));
 }
예제 #11
0
 public clsForm getAllLocations(clsForm pclsForm, ref clsResponse pclsResponse)
 {
     return(UserDA.getAllLocations(pclsForm, ref pclsResponse));
 }
예제 #12
0
 public clsForm getAllGenres(clsForm pclsForm, ref clsResponse pclsResponse)
 {
     return(UserDA.getAllGenres(pclsForm, ref pclsResponse));
 }