Ejemplo n.º 1
0
        public void OnSearchBarTextChanged(object sender, EventArgs eventArgs)
        {
            records.Clear();
            string str = GenLib.NormalizeGreek(GenLib.GreeklishToGreek(ASearchBar.Text));

            if (ASearchBar.Text.Equals(""))
            {
                return;
            }

            IEnumerable <Meal> meals = null;

            if (info.LoginUser.Fertility == 0)
            {
                meals = conn.Query <Meal>("SELECT name, IDMeal, NormalizedName, fertility FROM meal WHERE Deleted=0 AND (NormalizedName LIKE '" + str + "%' or NormalizedName LIKE '" + ASearchBar.Text + "%') " + " and IDLang=" + info.Settings.Lang + " and isactive=1");
            }
            else
            {
                meals = conn.Query <Meal>("SELECT name, IDMeal, NormalizedName FROM meal WHERE Deleted=0 AND (NormalizedName LIKE '" + str + "%' or NormalizedName NormalizedNameLIKE '" + ASearchBar.Text + "%') and IDLang=" + info.Settings.Lang + " and isactive=1 and fertility like '%" + info.LoginUser.Fertility.ToString() + "%'");
            }

            foreach (Meal meal in meals)
            {
                records.Add(new Meal {
                    Name = meal.Name, IDMeal = meal.IDMeal
                });
            }
        }
Ejemplo n.º 2
0
        public HttpResponseMessage GetCountry()
        {
            HttpResponseMessage hrm = new HttpResponseMessage();
            ResponseObj         ro  = new ResponseObj();

            try
            {
                SqlParameter[] prm = new SqlParameter[]
                {
                    new SqlParameter("@TYPE", "GET_COUNTRY"),
                };
                DataTable dt = new SQLHelper().ExecuteDataTable("[SP_LOCATION_NAME]", prm, CommandType.StoredProcedure);
                if (dt.Rows.Count > 0)
                {
                    ro.Status    = 1;
                    ro.Message   = "SUCCESS";
                    ro.dataTable = dt;
                }
                hrm = new GenLib().RecvAPIData(ro);
                return(hrm);
            }
            catch (Exception ex)
            {
                hrm = new GenLib().WriteErrorLog(ex);
                return(hrm);
            }
        }
Ejemplo n.º 3
0
        private async void PerformLogin(User user)
        {
            BeginLogin();
            ConnectionInfo info = StorageManager.GetConnectionInfo();

            info.LoginUser             = user;
            info.LoginUser.Password    = passwordEntry.Text;
            info.Settings.LastLoggedIn = user.IDUser;
            Settings settings = info.Settings;

            StorageManager.UpdateData <Settings>(settings);
            await GenLib.LoginSynch();

            if (user.Isactive == 0)
            {
                MessageLabel.Text = Properties.LangResource.notactive;
            }
            else
            {
                List <Weight> wghts = conn.Query <Weight>("SELECT IDWeight FROM Weight WHERE Deleted=0 AND IDUser="******"SELECT IDPlan FROM Plan WHERE Deleted=0 AND IDUser=" + user.IDUser);
                if (user.HeightType == -1 || user.Height == -1 || user.Gender == -1 || wghts.Count == 0 || plans.Count == 0)
                {
                    App.Current.MainPage = new LoginProcessPage();
                }
                else
                {
                    App.Current.MainPage = new MainPage();
                }
            }
            EndLogin();
        }
        public HttpResponseMessage AllSearch()
        {
            HttpResponseMessage hrm = new HttpResponseMessage();
            ResponseObj         ro  = new ResponseObj();

            try
            {
                SqlParameter[] prm = new SqlParameter[]
                {
                    new SqlParameter("@TYPE", "ALL_SEARCH")
                };
                DataTable DT = new SQLHelper().ExecuteDataTable("SP_INFORMATION", prm, CommandType.StoredProcedure);
                if (DT.Rows.Count > 0)
                {
                    ro.Status    = 1;
                    ro.Message   = "SUCCESS";
                    ro.dataTable = DT;
                }
                hrm = new GenLib().RecvAPIData(ro);
                return(hrm);
            }
            catch (Exception ex) {
                hrm = new GenLib().WriteErrorLog(ex);
                return(hrm);
            }
        }
        public HttpResponseMessage Get_Country()
        {
            HttpResponseMessage hrm = new HttpResponseMessage();
            ResponseObj         ro  = new ResponseObj();

            try
            {
                SqlParameter[] prm = new SqlParameter[]
                {
                    new SqlParameter("@TYPE", "GET_COUNTRY")
                };
                DataTable DT = new SQLHelper().ExecuteDataTable("SP_COUNTRY", prm, CommandType.StoredProcedure);
                if (DT.Rows.Count > 0)
                {
                    ro.Status    = 1;
                    ro.Message   = "Success";
                    ro.dataTable = DT;
                }
                hrm = new GenLib().RecvAPIData(ro);
                return(hrm);
            }
            catch (Exception ex) {
                hrm = new GenLib().WriteErrorLog(ex);
                return(hrm);
            }
        }
Ejemplo n.º 6
0
        private bool CheckValidMail()
        {
            bool isValid = GenLib.CheckValidMail(emailEntry.Text);

            if (!isValid)
            {
                MessageLabel.Text = Properties.LangResource.invalidemail;
            }
            return(isValid);
        }
Ejemplo n.º 7
0
        public MyDay()
        {
            InitializeComponent();
            conn         = StorageManager.GetConnection();
            info         = StorageManager.GetConnectionInfo();
            subscription = info.LoadActiveSubscription();

            GenLib.StartUp(loader);
            addmealview.MyDayPage      = this;
            logview.RecreateDataAction = RecreateData;
        }
Ejemplo n.º 8
0
        public HttpResponseMessage Insert(List <UserManagement> RequestData)
        {
            HttpResponseMessage hrm = new HttpResponseMessage();
            ResponseObj         ro  = new ResponseObj();

            try
            {
                if (RequestData.Count == 0)
                {
                    ro.Status  = 0;
                    ro.Message = "Pass Proper Data!!";
                }
                else
                {
                    SqlParameter[] prm = new SqlParameter[]
                    {
                        new SqlParameter("@TYPE", "INSERT"),
                        new SqlParameter("@FIRST_NAME", RequestData[0].FIRST_NAME),
                        new SqlParameter("@LAST_NAME", RequestData[0].LAST_NAME),
                        new SqlParameter("@EMAIL_ID", RequestData[0].EMAIL_ID),
                        new SqlParameter("@PHONE_NO", RequestData[0].PHONE_NO),
                        new SqlParameter("@ADDRESS_L1", RequestData[0].ADDRESS_L1),
                        new SqlParameter("@ADDRESS_L2", RequestData[0].ADDRESS_L2),
                        new SqlParameter("@CITY", RequestData[0].CITY),
                        new SqlParameter("@STATE", RequestData[0].STATE),
                        new SqlParameter("@COUNTRY", RequestData[0].COUNTRY)
                    };
                    string MSG = Convert.ToString(new SQLHelper().ExecuteScalar("SP_USER_LOGIN_INFORMATION", prm, CommandType.StoredProcedure));
                    if (MSG == "SUCCESSFULLY INSERT")
                    {
                        ro.Status  = 1;
                        ro.Message = "Data Insert Successfully";
                    }
                    else
                    {
                        ro.Status  = 0;
                        ro.Message = "Data not save!!";
                    }
                }
                hrm = new GenLib().RecvAPIData(ro);
                return(hrm);
            }
            catch (Exception ex)
            {
                hrm = new GenLib().WriteErrorLog(ex);
                return(hrm);
            }
        }
        public HttpResponseMessage SaveUser(List <Information_Model> RequestData)
        {
            HttpResponseMessage hrm = new HttpResponseMessage();
            ResponseObj         ro  = new ResponseObj();

            try
            {
                if (RequestData.Count == 0)
                {
                    ro.Status  = 0;
                    ro.Message = "pass proper data!!";
                }
                else
                {
                    SqlParameter[] prm = new SqlParameter[]
                    {
                        new SqlParameter("@TYPE", "INSERT"),
                        new SqlParameter("@NAME", RequestData[0].NAME),
                        new SqlParameter("@ADDRESS", RequestData[0].ADDRESS),
                        new SqlParameter("@EMAIL_ID", RequestData[0].EMAIL_ID),
                        new SqlParameter("@PHONE_NO", RequestData[0].PHONE_NO),
                        new SqlParameter("@CITY", RequestData[0].CITY),
                        new SqlParameter("@GENDER", RequestData[0].GENDER)
                    };
                    string MSG = Convert.ToString(new SQLHelper().ExecuteScalar("SP_INFORMATION", prm, CommandType.StoredProcedure));
                    if (MSG == "SUCCESSFYLL")
                    {
                        ro.Status  = 1;
                        ro.Message = "INSERT SUCCESSFULLY";
                    }
                    else
                    {
                        ro.Status  = 0;
                        ro.Message = "NO DATA INSERT";
                    }
                }
                hrm = new GenLib().RecvAPIData(ro);
                return(hrm);
            }
            catch (Exception ex)
            {
                hrm = new GenLib().WriteErrorLog(ex);
                return(hrm);
            }
        }
Ejemplo n.º 10
0
        private async void OnMailSendButtonClicked(object sender, EventArgs e)
        {
            if (emailEntry.Text == "" || emailEntry.Text == null)
            {
                MessageLabel.Text = Properties.LangResource.enterMail;
                return;
            }

            bool isValid = GenLib.CheckValidMail(emailEntry.Text);

            if (!isValid)
            {
                MessageLabel.Text = Properties.LangResource.invalidemail;
            }
            else
            {
                mailSend.IsEnabled = false;
                User user = new User();
                user.Email       = emailEntry.Text;
                user.AccessToken = this.GetRecoverToken(user.Email.ToString());

                ModelService <User> srvRecoverUser = await ServiceConnector.InsertServiceData <ModelService <User> >("/user/recover/", user);

                if (srvRecoverUser.success == true)
                {
                    await DisplayAlert(Properties.LangResource.message, Properties.LangResource.checkemail, "OK");

                    App.Current.MainPage = new LoginPage();
                }
                else if (srvRecoverUser.ErrorCode == 2)
                {
                    MessageLabel.Text = Properties.LangResource.usernotfound;
                }
                else
                {
                    MessageLabel.Text = Properties.LangResource.genericerror;
                }
                mailSend.IsEnabled = true;
            }
        }
        public HttpResponseMessage Mail_Search(List <Information_Model> RequestData)
        {
            HttpResponseMessage hrm = new HttpResponseMessage();
            ResponseObj         ro  = new ResponseObj();
            DataTable           DT  = new DataTable();

            try
            {
                if (RequestData.Count == 0)
                {
                    ro.Status  = 0;
                    ro.Message = "PASS PROPER DATA!!";
                }
                else
                {
                    SqlParameter[] prm = new SqlParameter[]
                    {
                        new SqlParameter("@TYPE", "SEARCH_MAIL"),
                        new SqlParameter("@EMAIL_ID", RequestData[0].EMAIL_ID)
                    };
                    DT = new SQLHelper().ExecuteDataTable("SP_INFORMATION", prm, CommandType.StoredProcedure);
                    if (DT.Rows.Count > 0)
                    {
                        ro.Status    = 1;
                        ro.Message   = "SECCESS";
                        ro.dataTable = DT;
                    }
                }
                hrm = new GenLib().RecvAPIData(ro);
                return(hrm);
            }
            catch (Exception ex)
            {
                hrm = new GenLib().WriteErrorLog(ex);
                return(hrm);
            }
        }
        public HttpResponseMessage Get_State(List <StateInformation> requestData)
        {
            HttpResponseMessage hrm = new HttpResponseMessage();
            ResponseObj         ro  = new ResponseObj();
            DataTable           DT  = new DataTable();

            try
            {
                if (requestData.Count == 0)
                {
                    ro.Status  = 0;
                    ro.Message = "Pleate Provide Proper Data";
                }
                else
                {
                    SqlParameter[] prm = new SqlParameter[]
                    {
                        new SqlParameter("@TYPE", "GET_STATE"),
                        new SqlParameter("@CID", requestData[0].Cid)
                    };
                    DT = new SQLHelper().ExecuteDataTable("SP_STATE", prm, CommandType.StoredProcedure);
                    if (DT.Rows.Count > 0)
                    {
                        ro.Status    = 1;
                        ro.Message   = "SUCCESSFULLY";
                        ro.dataTable = DT;
                    }
                }
                hrm = new GenLib().RecvAPIData(ro);
                return(hrm);
            }
            catch (Exception EX)
            {
                hrm = new GenLib().WriteErrorLog(EX);
                return(hrm);
            }
        }
Ejemplo n.º 13
0
        public HttpResponseMessage getstate(List <UserManagement> RequestData)
        {
            HttpResponseMessage hrm = new HttpResponseMessage();
            ResponseObj         ro  = new ResponseObj();

            try
            {
                if (RequestData.Count == 0)
                {
                    ro.Status  = 0;
                    ro.Message = "Please Pass correct data!!";
                }
                else
                {
                    SqlParameter[] prm = new SqlParameter[]
                    {
                        new SqlParameter("@TYPE", "GET_STATE"),
                        new SqlParameter("@C_ID", RequestData[0].C_ID)
                    };
                    DataTable dt = new SQLHelper().ExecuteDataTable("SP_STATE", prm, CommandType.StoredProcedure);
                    if (dt.Rows.Count > 0)
                    {
                        ro.Status    = 1;
                        ro.Message   = "SUCCESS";
                        ro.dataTable = dt;
                    }
                    hrm = new GenLib().RecvAPIData(ro);
                    return(hrm);
                }
            }
            catch (Exception ex)
            {
                hrm = new GenLib().WriteErrorLog(ex);
                return(hrm);
            }
        }
Ejemplo n.º 14
0
 private void NotifyLoacalServices(Alert alt)
 {
     GenLib.SetAlert(alt);
 }
Ejemplo n.º 15
0
 public void OnSynchClicked(object sender, EventArgs e)
 {
     GenLib.FullSynch(loader, true);
 }