public HttpResponseMessage Get()
        {
            try
            {
                Item        cust = null;
                DataTable   dt   = CGeneralBOFactory.CreateGeneralDataBO().GetItemDetails();
                List <Item> list = new List <Item>();


                if (dt.Rows.Count > 0 && dt != null)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        cust                = new Item();
                        cust.itemcode       = Convert.ToInt32(dt.Rows[i]["itemcode"]);
                        cust.itemname       = dt.Rows[i]["itemname"].ToString();
                        cust.QuantityonHand = Convert.ToInt32(dt.Rows[i]["QuantityonHand"]);
                        cust.price          = Convert.ToDecimal(dt.Rows[i]["price"]);
                        cust.webenabled     = Convert.ToBoolean(dt.Rows[i]["webenabled"]);

                        list.Add(cust);
                    }
                }
                return(Request.CreateResponse(HttpStatusCode.Found, list.ToList()));
            }
            catch (Exception)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Data found"));
            }
        }
Ejemplo n.º 2
0
 //[HttpPost]
 //[ActionName("PostCustomer")]
 //public void AddCustomer(Customer customer)
 //{
 //}
 public HttpResponseMessage Post([FromBody] Customer customer)
 {
     try
     {
         //int _id = Convert.ToInt32(customer.id);
         string _customername = customer.Customername.ToString();
         string _address      = customer.Address.ToString();
         string _street       = customer.street.ToString();
         string _country      = customer.country.ToString();
         string _email        = customer.email.ToString();
         long   _phone        = Convert.ToInt64(customer.phone);
         int    _zipcode      = Convert.ToInt32(customer.zipcode);
         bool   _response     = CGeneralBOFactory.CreateGeneralDataBO().AddCustomerDetails(_customername, _address, _street, _country, _email, _phone, _zipcode);
         if (_response)
         {
             var response = Request.CreateResponse(HttpStatusCode.Created, customer);
             response.Headers.Location = Request.RequestUri;
             return(response);
         }
         else
         {
             throw new Exception();
         }
     }
     catch
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Data not inserted"));
     }
 }
 public HttpResponseMessage Post([FromBody] Item item)
 {
     try
     {
         string  _itemname   = item.itemname.ToString();
         int     _quantity   = Convert.ToInt32(item.QuantityonHand);
         decimal _price      = Convert.ToDecimal(item.QuantityonHand);
         bool    _webenabled = Convert.ToBoolean(item.webenabled);
         bool    _response   = CGeneralBOFactory.CreateGeneralDataBO().AddItemDetails(_itemname, _quantity, _price, _webenabled);
         if (_response)
         {
             var response = Request.CreateResponse(HttpStatusCode.Created, item);
             response.Headers.Location = Request.RequestUri;
             return(response);
         }
         else
         {
             throw new Exception();
         }
     }
     catch
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Data not inserted"));
     }
 }
Ejemplo n.º 4
0
        public void GetLocationData()
        {
            DataTable locationlist = CGeneralBOFactory.CreateGeneralDataBO().Getlocationlist();

            ddlcountry.DataSource     = locationlist;
            ddlcountry.DataTextField  = "Location";
            ddlcountry.DataValueField = "id";
            ddlcountry.DataBind();
            ddlcountry.Items.Insert(0, new ListItem("Plese select", "-1"));
        }
Ejemplo n.º 5
0
        protected void changingselectedindex(object sender, System.EventArgs e)
        {
            int       location  = Convert.ToInt16(ddlcountry.SelectedValue);
            DataTable imagelist = CGeneralBOFactory.CreateGeneralDataBO().Getimagelist(location);

            if (imagelist.Rows.Count > 0)
            {
                datalist1.DataSource = imagelist;

                datalist1.DataBind();
            }
        }
Ejemplo n.º 6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string mail = txtemail.Text;
            string pass = txtpass.Text;

            byte[] key = new byte[16];
            byte[] iv  = new byte[16];
            for (int i = 0; i < 16; i++)
            {
                key[i] = 0x20;
            }
            for (int i = 0; i < 16; i++)
            {
                iv[i] = 0x30;
            }

            byte[] data      = Encoding.ASCII.GetBytes(pass);
            byte[] encrypted = Encrypt(data, key, iv);

            StringBuilder hex = new StringBuilder(encrypted.Length * 2);

            foreach (byte b in encrypted)
            {
                hex.AppendFormat("{0:x2}", b);
            }
            string abc = hex.ToString();

            string _username;

            try
            {
                long num = long.Parse(mail);
                _username = CGeneralBOFactory.CreateGeneralDataBO().ValidateUser(num, pass, mail = null);
            }
            catch (Exception ex)
            {
                _username = CGeneralBOFactory.CreateGeneralDataBO().ValidateUser(0, pass, mail);
            }


            if (_username != null)
            {
                Session["username"] = _username;
                Response.Redirect("BookingPage.aspx");
                Session.RemoveAll();
            }
            else
            {
                Label1.Text = "Invalid Credentials";
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Grant resource owner credentials overload method.
        /// </summary>
        /// <param name="context">Context parameter</param>
        /// <returns>Returns when task is completed</returns>
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            // Initialization.
            string usernameVal = context.UserName;
            string passwordVal = context.Password;

            DataTable    users = CGeneralBOFactory.CreateGeneralDataBO().LoginByUsernamePassword(usernameVal, passwordVal);
            List <Login> user  = new List <Login>();

            user = (from DataRow dr in users.Rows
                    select new Login()
            {
                id = Convert.ToInt32(dr["id"]),
                UserName = dr["username"].ToString(),
                Password = dr["password"].ToString()
            }).ToList();
            // Verification.
            if (user == null || user.Count() <= 0)
            {
                // Settings.
                context.SetError("invalid_grant", "The user name or password is incorrect.");

                // Retuen info.
                return;
            }

            // Initialization.
            var claims   = new List <Claim>();
            var userInfo = user.FirstOrDefault();

            // Setting
            claims.Add(new Claim(ClaimTypes.Name, userInfo.UserName));

            // Setting Claim Identities for OAUTH 2 protocol.
            ClaimsIdentity oAuthClaimIdentity   = new ClaimsIdentity(claims, OAuthDefaults.AuthenticationType);
            ClaimsIdentity cookiesClaimIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationType);

            // Setting user authentication.
            AuthenticationProperties properties = CreateProperties(userInfo.UserName);
            AuthenticationTicket     ticket     = new AuthenticationTicket(oAuthClaimIdentity, properties);

            // Grant access to authorize user.
            context.Validated(ticket);
            context.Request.Context.Authentication.SignIn(cookiesClaimIdentity);
        }
        public HttpResponseMessage Delete(int itemcode)
        {
            try
            {
                bool _response = CGeneralBOFactory.CreateGeneralDataBO().Removeitems(itemcode);
                if (!_response)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Product not found to delete"));
                }


                return(Request.CreateResponse(HttpStatusCode.OK, "Product Deleted Successfully"));
            }
            catch (Exception)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Product not deleted"));
            }
        }
 public HttpResponseMessage Post([FromBody] Sales sales)
 {
     try
     {
         int     _referenceNumber = Convert.ToInt32(sales.ReferenceNumber);
         string  _customerName    = sales.CustomerName.ToString();
         string  _DocDate         = sales.DocDate.ToString();
         string  _postingDate     = sales.PostingDate.ToString();
         string  _address         = sales.Address.ToString();
         int     _docTotal        = Convert.ToInt32(sales.DocTotal);
         string  _state           = sales.State.ToString();
         long    _zipcode         = Convert.ToInt64(sales.Zipcode);
         string  _street          = sales.Street.ToString();
         string  _country         = sales.Country.ToString();
         string  _salesPerson     = sales.SalesPerson.ToString();
         int     _itemNo          = Convert.ToInt32(sales.ItemNo);
         int     _quantityordered = Convert.ToInt32(sales.Quantityordered);
         decimal _price           = Convert.ToDecimal(sales.Price);
         decimal _linetotal       = Convert.ToDecimal(sales.linetotal);
         bool    _response        = CGeneralBOFactory.CreateGeneralDataBO().AddSalesOrderDetails(_referenceNumber, _customerName, _DocDate, _postingDate, _address, _docTotal
                                                                                                 , _state, _zipcode, _street, _country, _salesPerson, _itemNo, _quantityordered, _price, _linetotal);
         if (_response)
         {
             var response = Request.CreateResponse(HttpStatusCode.Created, sales);
             response.Headers.Location = Request.RequestUri;
             return(response);
         }
         else
         {
             throw new Exception();
         }
     }
     catch
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Data not inserted"));
     }
 }
Ejemplo n.º 10
0
        public Customer Get(int id)
        {
            Customer  cust = null;
            DataTable dt   = CGeneralBOFactory.CreateGeneralDataBO().GetCustomerDetails(id);

            if (dt.Rows.Count > 0 && dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    cust              = new Customer();
                    cust.id           = Convert.ToInt32(row["id"]);
                    cust.Customername = row["Customername"].ToString();
                    cust.Address      = row["Address"].ToString();
                    cust.street       = row["street"].ToString();
                    cust.country      = row["country"].ToString();
                    cust.email        = row["email"].ToString();
                    cust.phone        = Convert.ToInt64(row["phone"]);
                    cust.zipcode      = Convert.ToInt32(row["zipcode"]);
                }
            }


            return(cust);
        }
Ejemplo n.º 11
0
        public string PayAmount(string showid, string seatId, string isPaid)
        {
            bool val = CGeneralBOFactory.CreateGeneralDataBO().updateSeatStatus(showid, seatId, isPaid);

            return(val + "");
        }
Ejemplo n.º 12
0
        public static string getShowDetails()
        {
            string dt = CGeneralBOFactory.CreateGeneralDataBO().getShowDetails("1");

            return(dt);
        }
Ejemplo n.º 13
0
        public static string UpdateSeatStatus(string showid, string seatId, string isPaid = null)
        {
            bool temp = CGeneralBOFactory.CreateGeneralDataBO().updateSeatStatus(showid, seatId, isPaid);

            return(temp + "");
        }
Ejemplo n.º 14
0
        public static string loadAllSeats()
        {
            string dt = CGeneralBOFactory.CreateGeneralDataBO().getSeatStatus("1");

            return(dt);
        }