Ejemplo n.º 1
0
    public bool UpdateItem(bookinterface item)
    {
        using (objMyLq = new alamaatDBDataContext())
        {
            try
            {
                var objcontent = objMyLq.alamaat_products.Where(p => p.id == item.ID).FirstOrDefault();
                if (null != objcontent)
                {
                    objcontent.productname   = item.Name;
                    objcontent.category      = item.Category;
                    objcontent.originalprice = item.OriginalPrice;
                    objcontent.discount      = item.Discount;
                    objcontent.price         = item.Price;
                    objcontent.details       = item.Details;
                    objcontent.rating        = item.Rating;
                    objcontent.lastmodified  = DateTime.Now;
                    objcontent.fileid        = item.Imageid;

                    objMyLq.SubmitChanges();
                    return(true);
                }
                return(false);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
    }
Ejemplo n.º 2
0
    public bool DeleteItem(Guid id)
    {
        using (objMyLq = new alamaatDBDataContext())
        {
            try
            {
                var objcontent = objMyLq.alamaat_products.SingleOrDefault(p => p.id == id);
                if (objcontent != null)
                {
                    var objfile = objMyLq.FileMasters.SingleOrDefault(p => p.id == objcontent.fileid);
                    if (objfile != null)
                    {
                        List <ProductThumb> thumbs = objMyLq.ProductThumbs.Where(t => t.fileid == objfile.id).ToList();
                        foreach (ProductThumb thumb in thumbs)
                        {
                            objMyLq.ProductThumbs.DeleteOnSubmit(thumb);
                        }
                        objMyLq.FileMasters.DeleteOnSubmit(objfile);
                    }
                    objMyLq.alamaat_products.DeleteOnSubmit(objcontent);
                    objMyLq.SubmitChanges();
                    return(true);
                }

                return(false);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
    }
Ejemplo n.º 3
0
 public bool InsertItem(bookinterface item)
 {
     using (objMyLq = new alamaatDBDataContext())
     {
         try
         {
             alamaat_product newitem = new alamaat_product();
             newitem.id            = Guid.NewGuid();
             newitem.productname   = item.Name;
             newitem.category      = item.Category;
             newitem.originalprice = item.OriginalPrice;
             newitem.details       = item.Details;
             newitem.rating        = item.Rating;
             newitem.created       = DateTime.Now;
             newitem.lastmodified  = DateTime.Now;
             newitem.fileid        = item.Imageid;
             newitem.discount      = item.Discount;
             newitem.price         = item.Price;
             objMyLq.alamaat_products.InsertOnSubmit(newitem);
             objMyLq.SubmitChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Ejemplo n.º 4
0
    public bool UpdateUser(UserInterface user)
    {
        using (objMyLq = new alamaatDBDataContext())
        {
            try
            {
                var objcontent = objMyLq.alamaat_Users.Single(p => p.username == user.UserName);
                objcontent.firstname    = user.FirstName;
                objcontent.lastname     = user.LastName;
                objcontent.username     = user.UserName;
                objcontent.email        = user.Email;
                objcontent.registerDate = DateTime.Now;
                // objNewcontent.block = false;
                objcontent.address     = user.Address;
                objcontent.city        = user.City;
                objcontent.province    = user.Province;
                objcontent.country     = user.Country;
                objcontent.postalcode  = user.PCode;
                objcontent.phone       = user.Phone;
                objcontent.mobilephone = user.MobilePhone;
                objcontent.fax         = user.Fax;
                objMyLq.SubmitChanges();

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
    }
Ejemplo n.º 5
0
 public bool UpdateOrderStatus(alamaat_Order order)
 {
     using (objMyLq = new alamaatDBDataContext())
     {
         try
         {
             var objcontent = objMyLq.alamaat_Orders.FirstOrDefault(p => p.id == order.id);
             objcontent.orderstatus = order.orderstatus;
             objMyLq.SubmitChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Ejemplo n.º 6
0
    public bool UpdateSubscriber(SubscriberInterface user)
    {
        using (objMyLq = new alamaatDBDataContext())
        {
            try
            {
                var objcontent = objMyLq.alamaat_subscribers.Single(p => p.id == user.ID);
                objcontent.active = user.Active;
                objMyLq.SubmitChanges();

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
    }
Ejemplo n.º 7
0
    public bool DeleteUser(UserInterface _objcontent)
    {
        using (objMyLq = new alamaatDBDataContext())
        {
            try
            {
                var objcontent = objMyLq.alamaat_Users.Single(p => p.username == _objcontent.UserName);
                // objcontent.Active = false;
                // objcontent.SyncDate = DateTime.Now;
                objMyLq.SubmitChanges();

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
    }
Ejemplo n.º 8
0
 public alamaat_User GetuserByEmail(string email)
 {
     using (objMyLq = new alamaatDBDataContext())
     {
         try
         {
             List <alamaat_User> user = objMyLq.alamaat_Users.Where(ku => ku.email.ToLower().Equals(email.ToLower())).ToList();
             if (user.Count >= 1)
             {
                 return(user[0]);
             }
             else
             {
                 return(null);
             }
         }
         catch (Exception ex) { return(null); }
     }
 }
Ejemplo n.º 9
0
    public ProductThumb Getimage(Guid id)
    {
        using (objMyLq = new alamaatDBDataContext())
        {
            try
            {
                var objcontent = objMyLq.ProductThumbs.SingleOrDefault(p => p.id == id);
                if (objcontent != null)
                {
                    return(objcontent);
                }

                return(null);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
    }
Ejemplo n.º 10
0
 public bool UpdateSubscriber(alamaat_subscriber user)
 {
     using (objMyLq = new alamaatDBDataContext())
     {
         try
         {
             var objcontent = objMyLq.alamaat_subscribers.Single(p => p.id == user.id);
             if (null != objcontent)
             {
                 objcontent.active = true;
                 objMyLq.SubmitChanges();
                 return(true);
             }
             return(false);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Ejemplo n.º 11
0
 public bool InsertSubscriber(SubscriberInterface user)
 {
     using (objMyLq = new alamaatDBDataContext())
     {
         try
         {
             alamaat_subscriber objNewcontent = new alamaat_subscriber();
             objNewcontent.id      = user.ID;
             objNewcontent.email   = user.Email;
             objNewcontent.active  = user.Active;
             objNewcontent.created = DateTime.Now;
             objMyLq.alamaat_subscribers.InsertOnSubmit(objNewcontent);
             objMyLq.SubmitChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Ejemplo n.º 12
0
    public bool DeleteThumb(Guid id)
    {
        using (objMyLq = new alamaatDBDataContext())
        {
            try
            {
                var objcontent = objMyLq.ProductThumbs.SingleOrDefault(p => p.id == id);
                if (objcontent != null)
                {
                    objMyLq.ProductThumbs.DeleteOnSubmit(objcontent);
                    objMyLq.SubmitChanges();
                    return(true);
                }

                return(false);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
    }
Ejemplo n.º 13
0
 public bool InsertUser(UserInterface user)
 {
     using (objMyLq = new alamaatDBDataContext())
     {
         try
         {
             alamaat_User objNewcontent = new alamaat_User();
             objNewcontent.id           = user.ID;
             objNewcontent.title        = user.Title;
             objNewcontent.firstname    = user.FirstName;
             objNewcontent.lastname     = user.LastName;
             objNewcontent.username     = user.UserName;
             objNewcontent.password     = user.Password;
             objNewcontent.middlename   = user.MiddleName;
             objNewcontent.email        = user.Email;
             objNewcontent.registerDate = DateTime.Now;
             objNewcontent.block        = false;
             objNewcontent.active       = false;
             objNewcontent.address      = user.Address;
             objNewcontent.city         = user.City;
             objNewcontent.province     = user.Province;
             objNewcontent.country      = user.Country;
             objNewcontent.postalcode   = user.PCode;
             objNewcontent.phone        = user.Phone;
             objNewcontent.mobilephone  = user.MobilePhone;
             objNewcontent.fax          = user.Fax;
             objMyLq.alamaat_Users.InsertOnSubmit(objNewcontent);
             objMyLq.SubmitChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Ejemplo n.º 14
0
    public bool InsertOrder(OrderInterface order, List <OrderItems> Items)
    {
        using (objMyLq = new alamaatDBDataContext())
        {
            try
            {
                alamaat_Order neworder = new alamaat_Order();
                neworder.id = Guid.NewGuid();
                DateTime date = DateTime.Now;
                //neworder.order_number = "A" + date.ToShortDateString() + date.ToShortTimeString();
                neworder.order_number    = order.OrderNumber;
                neworder.subtotal        = order.SubTotal;
                neworder.discount        = order.Discount;
                neworder.tax             = order.Tax;
                neworder.total           = order.Total;
                neworder.orderstatus     = "Pending";
                neworder.created         = DateTime.Now;
                neworder.lastmodified    = DateTime.Now;
                neworder.shipment        = order.Shipment;
                neworder.shippingtotal   = order.Total;
                neworder.lastedit        = order.Lastedit;
                neworder.shipfirstname   = order.Shipfirstname;
                neworder.shiplastname    = order.Shiplastname;
                neworder.shipmiddlename  = order.Shipmiddlename;
                neworder.shipcompanyname = order.Shipcompany;
                neworder.shipaddress     = order.ShipAddress;
                neworder.shippostalcode  = order.ShipPostalcode;
                neworder.shipcity        = order.ShipCity;
                neworder.shipcountry     = order.ShipCountry;
                neworder.shipphone       = order.ShipPhone;
                neworder.shipmobilephone = order.ShipMobilephone;
                neworder.shipfax         = order.Shipfax;

                neworder.billfirstname   = order.Billfirstname;
                neworder.billlastname    = order.Billlastname;
                neworder.billmiddlename  = order.Billmiddlename;
                neworder.billemail       = order.Billemail;
                neworder.billcompanyname = order.Billcompany;
                neworder.billaddress     = order.BillAddress;
                neworder.billpostalcode  = order.BillPostalcode;
                neworder.billcity        = order.BillCity;
                neworder.billcountry     = order.BillCountry;
                neworder.billphone       = order.BillPhone;
                neworder.billmobilephone = order.BillMobilephone;
                neworder.billfax         = order.Billfax;

                objMyLq.alamaat_Orders.InsertOnSubmit(neworder);

                foreach (var item in Items)
                {
                    Order_product ordItem = new Order_product();
                    ordItem.id         = item.ID;
                    ordItem.order_id   = neworder.id;
                    ordItem.name       = item.Name;
                    ordItem.status     = "Pending";
                    ordItem.price      = item.Price;
                    ordItem.quantity   = item.Quantity;
                    ordItem.discount   = item.Discount;
                    ordItem.total      = item.Total;
                    ordItem.product_id = item.Productid;
                    objMyLq.Order_products.InsertOnSubmit(ordItem);
                }
                objMyLq.SubmitChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
    }