public void ProcessRequest(HttpContext context)
        {
            string sopt = string.Empty;
            string skey = string.Empty;
            string sData = string.Empty;

            YardeCartServiceApp.YardeCartServices objYard = new YardeCartServices();

            System.Collections.Specialized.NameValueCollection forms = context.Request.Form;
            string strOperation = forms.Get("oper");

            if (strOperation == null && context.Request.QueryString != null)
            {
                sopt = context.Request.QueryString["opt"].ToString();
                skey = context.Request.QueryString["str"].ToString();
                if (sopt == "1")
                    sData = objYard.SearchAdsByUsername(skey);
                else if (sopt == "2")
                    sData = objYard.SearchAdsByAdtitle(skey);

                context.Response.Write(sData);
            }
            else
            {

            }
        }
        public void ProcessRequest(HttpContext context)
        {
            YardeCartServiceApp.YardeCartServices objYard = new YardeCartServices();

            System.Collections.Specialized.NameValueCollection forms = context.Request.Form;
            string strOperation = forms.Get("oper");
            if (strOperation == null)
            {
                string s = objYard.SelectAllProfile();
                context.Response.Write(s);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            YardeCartServiceApp.YardeCartServices objYard = new YardeCartServices();

            System.Collections.Specialized.NameValueCollection forms = context.Request.Form;
            string strOperation = forms.Get("oper");
            if (strOperation == null)
            {
                string s = objYard.SelectChargeDetails();
                s = s.Replace("\"ChargeType\":0", "\"ChargeType\":\"Amount\"");
                s = s.Replace("\"ChargeType\":1", "\"ChargeType\":\"Percentage\"");
                context.Response.Write(s);//jsonSerializer.Serialize(collectionEmployee.AsQueryable<Employee>().ToList<Employee>()));

            }
            else if (strOperation == "add")
            {
                string strOut = string.Empty;
                YardeCartData.ChargeDetails datac = new YardeCartData.ChargeDetails();

                datac.ChargeId = 0;
                datac.ChargeName = forms.Get("ChargeName");
                datac.ChargeType = Convert.ToInt32(forms.Get("ChargeType"));
                datac.AmountOrPercent = forms.Get("AmountOrPercent").ToString();

                int id = objYard.AddChargeDetails(datac);
                strOut = "Category record successfully updated";
                context.Response.Write(strOut);
            }
            else if (strOperation == "del")
            {
                var gid = forms.Get("ChargeId").ToString();
                objYard.ChargeDetailsDelete(Convert.ToInt32(gid));
                string strResponse = "Category record successfully removed";
                context.Response.Write(strResponse);
            }
            else
            {
                string strOut = string.Empty;

                YardeCartData.ChargeDetails datac = new YardeCartData.ChargeDetails();

                datac.ChargeId = Convert.ToInt32(forms.Get("ChargeId").ToString()); ;
                datac.ChargeName = forms.Get("ChargeName");
                datac.ChargeType = Convert.ToInt32(forms.Get("ChargeType"));
                datac.AmountOrPercent = forms.Get("AmountOrPercent").ToString();

                int id = objYard.AddChargeDetails(datac);
                strOut = "Category record successfully updated";

                context.Response.Write(strOut);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            YardeCartServiceApp.YardeCartServices objYard = new YardeCartServices();

            System.Collections.Specialized.NameValueCollection forms = context.Request.Form;
            string strOperation = forms.Get("oper");
            if (strOperation == null)
            {
                string s = objYard.SelectAllCategory();
                context.Response.Write(s);//jsonSerializer.Serialize(collectionEmployee.AsQueryable<Employee>().ToList<Employee>()));

            }
            else if (strOperation == "add")
            {
                string strOut = string.Empty;
                YardeCartData.CategoryDetails datac = new YardeCartData.CategoryDetails();

                datac.CategoryId = 0;
                datac.CategoryName = forms.Get("CategoryName");
                datac.CategoryGroupId = Convert.ToInt32(forms.Get("CategoryGroupName"));

                int id = objYard.AddCategory(datac);
                strOut = "Category record successfully updated";
                context.Response.Write(strOut);
            }
            else if (strOperation == "del")
            {
                var gid = forms.Get("CategoryId").ToString();
                objYard.CategoryDelete(Convert.ToInt32(gid));
                string strResponse = "Category record successfully removed";
                context.Response.Write(strResponse);
            }
            else
            {
                string strOut = string.Empty;

                YardeCartData.CategoryDetails datac = new YardeCartData.CategoryDetails();

                datac.CategoryId = Convert.ToInt32(forms.Get("CategoryId").ToString()); ;
                datac.CategoryName = forms.Get("CategoryName").ToString();
                datac.CategoryGroupId = Convert.ToInt32(forms.Get("CategoryGroupName"));

                int id = objYard.AddCategory(datac);
                strOut = "Category record successfully updated";

                context.Response.Write(strOut);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            YardeCartServiceApp.YardeCartServices objYard = new YardeCartServices();
            if (context.Request.QueryString["dtf"] != null)
            {
                sFromDate = context.Request.QueryString["dtf"].ToString();
                sToDate = context.Request.QueryString["dtt"].ToString();
                sData = objYard.SelectReportsByDate(sFromDate, sToDate);
            }
            else if (context.Request.QueryString["reg"] != null)
            {
                sData = objYard.SelectReportsByCity(context.Request.QueryString["reg"].ToString());
            }

            context.Response.Write(sData);
        }
        public void ProcessRequest(HttpContext context)
        {
            string s = context.Request.QueryString["uid"].ToString();
            string sRem = context.Request.QueryString["rem"].ToString();
            //if (context.Session["UserId"] == null)
            context.Session.RemoveAll();
            context.Session.Add("UserId", s);
            YardeCartData.UserDetails ou= new YardeCartData.UserDetails();
            ou.UserId=Convert.ToInt32(s);
            YardeCartServiceApp.YardeCartServices oy = new YardeCartServices();
            DataTable dt = oy.SelectUserProfile(ou);
            string stype = "";
            string UserName = "";
            string Password = "";
            if (dt.Rows.Count > 0)
            {
                stype = dt.Rows[0]["UserStatus"].ToString();
                UserName = dt.Rows[0]["UserName"].ToString();
                Password = dt.Rows[0]["UserPassword"].ToString();
            }
            context.Session.Add("UserType", stype);

            HttpCookie cUserId = new HttpCookie("UserId", s.ToString().Trim());
            HttpCookie cUsertype = new HttpCookie("UserType", stype);
            cUserId.Expires = DateTime.Now.AddDays(5);
            cUsertype.Expires = DateTime.Now.AddDays(5);
            context.Response.Cookies.Add(cUserId);
            context.Response.Cookies.Add(cUsertype);

            if (sRem == "true")
            {
                //Response.Cookies.Clear();
                HttpCookie cUsername = new HttpCookie("UserName", UserName.ToString().Trim());
                HttpCookie cPassword = new HttpCookie("Password", Password.ToString().Trim());
                cUsername.Expires = DateTime.Now.AddDays(5);
                cPassword.Expires = DateTime.Now.AddDays(5);

                context.Response.Cookies.Add(cUsername);
                context.Response.Cookies.Add(cPassword);
            }
            else
            {
                context.Request.Cookies.Remove("UserName");
                context.Request.Cookies.Remove("Password");
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            strServicePath = ConfigurationManager.AppSettings["ServicePath"].ToString();
            if (Request.Cookies["UserType"] != null)
            {
                Session.Add("UserType", Request.Cookies["UserType"].Value.ToString());
            }
            if (Request.QueryString.Count == 1)
            {
                //if (this.Page.Title.Contains("Activa") == false)
                {
                    //if (Session["UserId"] == null)
                        //Session.Add("UserId", Request.QueryString["uid"].ToString());
                }
            }
            else if (Request.Cookies["UserId"] != null)
            {
                Session.Add("UserId", Request.Cookies["UserId"].Value.ToString());
            }

            if ((Session["UserId"] != null && Session["UserType"] != null && Session["UserType"].ToString() == "2"))
            {
                welcomeMessage.InnerText = "Welcome Admin";
                isShowHideControl = "2";
            }
            else if (Session["UserId"] == null)
            {
                welcomeMessage.InnerText = "Welcome Guest";
                isShowHideControl = "0";
            }
            else
            {
                YardeCartServiceApp.YardeCartServices ySer=new YardeCartServices();

                YardeCartData.UserDetails yData = new YardeCartData.UserDetails();
                yData.UserId = Convert.ToInt32(Session["UserId"].ToString());
                //DataTable dt = ySer.SelectUserProfile(yData);
                //Array[] user = JsonConvert.DeserializeObject<Array[]>(dt);
                //if (dt.Rows.Count > 0)
                {
                   // welcomeMessage.InnerText = "Welcome " + dt.Rows[0]["UserName"].ToString();
                }
                isShowHideControl = "1";
            }
        }