示例#1
0
        // GET: Category
        public int SaveCategory(Ent_Category model)
        {
            SafeTransaction trans = new SafeTransaction();


            DateTime indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            DateTime indiTime   = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s"));

            model.Created_Date = indiTime;
            HttpCookie C_UserID = Request.Cookies["User_ID"];
            string     User_ID  = C_UserID != null?C_UserID.Value.Split('=')[1] : "";

            model.Created_By = Convert.ToInt32(User_ID);
            int i = balCategory.SaveCategory(model, trans);

            if (i > 0)
            {
                trans.Commit();
            }
            else
            {
                trans.Rollback();
            }

            return(i);
        }
示例#2
0
        public int RegisterGuest(Ent_Guest model)
        {
            int             result     = 0;
            SafeTransaction trans      = new SafeTransaction();
            DateTime        indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            DateTime        indiTime   = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s"));

            model.Created_Date = indiTime;
            string uniqueId = Guid.NewGuid().ToString();

            model.Unique_ID = uniqueId;
            result          = balGuest.SaveGuest(model, trans);
            if (result > 0)
            {
                trans.Commit();
                var lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("ActivateAccount", "Login", new { id = uniqueId }) + "' target='_blank' style='display: inline-block; padding: 16px 36px; font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif; font-size: 16px; color: #ffffff; text-decoration: none; border-radius: 6px;'>Confirm Your Mail</a>";

                string body = string.Empty;
                using (StreamReader reader = new StreamReader(Server.MapPath("~/confirm.html")))
                {
                    body = reader.ReadToEnd();
                }
                body = body.Replace("{Url}", lnkHref);
                Email email = new Email();
                email.SendMail(body, model.Guest_Username, "Account Activation");
            }
            else
            {
                trans.Rollback();
            }
            return(result);
        }
示例#3
0
        public int DeleteCategory(int Category_ID)
        {
            Ent_Category ent = new Ent_Category();

            ent.Category_ID = Category_ID;

            HttpCookie UserID = Request.Cookies["User_ID"];
            var        UserId = UserID != null?UserID.Value.Split('=')[1] : "";

            ent.Modified_By = Convert.ToInt32(UserId);
            DateTime indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            DateTime indiTime   = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s"));

            ent.Modified_Date = indiTime;
            SafeTransaction trans = new SafeTransaction();
            int             i     = balCategory.DeleteCategory(ent, trans);

            if (i > 0)
            {
                trans.Commit();
            }
            else
            {
                trans.Rollback();
            }

            return(i);
        }
示例#4
0
        public int UpdateOrderStatus(Ent_Order ent)
        {
            int             result     = 0;
            SafeTransaction trans      = new SafeTransaction();
            DateTime        indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            DateTime        indiTime   = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s"));

            ent.Created_Date = indiTime;
            result           = balOrder.UpdateOrderStatus(ent, trans);
            if (result > 0)
            {
                trans.Commit();
                string body = string.Empty; var lnkHref = "";
                if (ent.Is_Active == 2)
                {
                    if (ent.Guest_ID == 0)
                    {
                        lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("TrackOrder", "Order", new { Order_ID = ent.Order_ID }) + "' target = '_blank' style = 'color: #fc7ca0;' > here </a>";
                    }
                    else
                    {
                        lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("Register", "Login") + "' target = '_blank' style = 'color: #fc7ca0;' > here </a>";
                    }

                    using (StreamReader reader = new StreamReader(Server.MapPath("~/Shipping.html")))
                    {
                        body = reader.ReadToEnd();
                    }
                    body = body.Replace("{Url}", lnkHref);

                    Email em = new Email();
                    em.SendConfirmationMail(ent.Order_ID, body, "Order Shipped");
                }
                else if (ent.Is_Active == 3)
                {
                    if (ent.Guest_ID == 0)
                    {
                        lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("TrackOrder", "Order", new { Order_ID = ent.Order_ID }) + "' target = '_blank' style = 'color: #fc7ca0;' > here </a>";
                    }
                    else
                    {
                        lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("Register", "Login") + "' target = '_blank' style = 'color: #fc7ca0;' > here </a>";
                    }

                    using (StreamReader reader = new StreamReader(Server.MapPath("~/Delivered.html")))
                    {
                        body = reader.ReadToEnd();
                    }
                    body = body.Replace("{Url}", lnkHref);

                    Email eml = new Email();
                    eml.SendConfirmationMail(ent.Order_ID, body, "Order Delivered");
                }
            }
            else
            {
                trans.Rollback();
            }
            return(result);
        }
示例#5
0
        public int UpdatePayment(Ent_Order entOrder)
        {
            SafeTransaction trans    = new SafeTransaction();
            HttpCookie      Guest_ID = Request.Cookies["Guest_ID"];
            int             ID       = Guest_ID != null?Convert.ToInt32(Guest_ID.Value.Split('=')[1]) : 0;

            entOrder.Guest_ID = ID;
            int i = balOrder.UpdatePayment(entOrder, trans);

            if (i > 0)
            {
                trans.Commit();
                if (entOrder.Payment_Status == "CAPTURED")
                {
                    string body = string.Empty; var lnkHref = "";
                    if (ID == 0)
                    {
                        lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("TrackOrder", "Order", new { Order_ID = entOrder.Order_ID }) + "' target = '_blank' style = 'color: #fc7ca0;' > here </ a >";
                    }
                    else
                    {
                        lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("Register", "Login") + "' target = '_blank' style = 'color: #fc7ca0;' > here </ a >";
                    }

                    using (StreamReader reader = new StreamReader(Server.MapPath("~/OrderConfirmation.html")))
                    {
                        body = reader.ReadToEnd();
                    }
                    body = body.Replace("{Url}", lnkHref);

                    Email em = new Email();
                    em.SendConfirmationMail(entOrder.Order_ID, body, "Order Confirmation");
                    if (ID != 0)
                    {
                        SafeTransaction transac = new SafeTransaction();
                        int             result  = balOrder.DeleteCart(0, ID, transac);
                        if (result > 0)
                        {
                            transac.Commit();
                        }
                        else
                        {
                            transac.Rollback();
                        }
                    }

                    Session["Cart"]     = null;
                    Session["Total"]    = null;
                    Session["SubTotal"] = null;
                    Session["Shipping"] = null;
                }
            }
            else
            {
                trans.Rollback();
            }

            return(i);
        }
示例#6
0
        public int UpdateCart(List <Ent_Product> CartList)
        {
            float total = 0;
            List <Ent_OrderDetail> item = new List <Ent_OrderDetail>();

            for (int i = 0; i < CartList.Count; i++)
            {
                item.Add(new Ent_OrderDetail()
                {
                    Product_ID    = CartList[i].Product_ID,
                    Product_Name  = CartList[i].Product_Name,
                    Quantity      = CartList[i].Quantity,
                    Product_Price = CartList[i].Product_Price,
                    Product_Image = CartList[i].Product_Image,
                    Product_Total = CartList[i].Quantity * CartList[i].Product_Price,
                });

                HttpCookie Guest_ID = Request.Cookies["Guest_ID"];
                string     GuestID  = Guest_ID != null?Guest_ID.Value.Split('=')[1] : "";

                if (!string.IsNullOrEmpty(GuestID))
                {
                    Ent_OrderDetail entP = new Ent_OrderDetail();
                    entP.Cart_ID    = 1;
                    entP.Product_ID = CartList[i].Product_ID;
                    entP.Quantity   = CartList[i].Quantity;
                    entP.Guest_ID   = Convert.ToInt32(GuestID);
                    SafeTransaction trans  = new SafeTransaction();
                    int             result = balOrder.InsertCart(entP, trans);
                    if (result > 0)
                    {
                        trans.Commit();
                    }
                    else
                    {
                        trans.Rollback();
                    }
                }

                total           = total + (CartList[i].Quantity * CartList[i].Product_Price);
                Session["Cart"] = item;
                item            = (List <Ent_OrderDetail>)Session["Cart"];
            }
            Session["SubTotal"] = Session["Total"] = total;

            return(1);
        }
示例#7
0
        public ActionResult DeleteCart(int CartID)
        {
            List <Ent_OrderDetail> list = (List <Ent_OrderDetail>)Session["Cart"];
            Ent_Product            ent  = new Ent_Product();

            ent = balProduct.SelectProduct(CartID);
            var qty = list.Where(l => l.Product_ID == CartID).FirstOrDefault().Quantity;

            Session["Cart"] = list.Where(l => l.Product_ID != CartID).ToList <Ent_OrderDetail>();

            int count = list.Count - 1;

            Session["SubTotal"] = Convert.ToInt32(Session["SubTotal"]) - ((ent.Product_Price - ent.Product_Discount) * qty);
            Session["Total"]    = Convert.ToInt32(Session["Total"]) - ((ent.Product_Price - ent.Product_Discount) * qty);
            if (list.Count == 1)
            {
                Session["Cart"]     = null;
                Session["Total"]    = "0.00";
                Session["SubTotal"] = "0.00";
                Session["Shipping"] = "0.00";
            }

            HttpCookie Guest_ID = Request.Cookies["Guest_ID"];
            string     GuestID  = Guest_ID != null?Guest_ID.Value.Split('=')[1] : "";

            if (!string.IsNullOrEmpty(GuestID))
            {
                SafeTransaction trans  = new SafeTransaction();
                int             result = balOrder.DeleteCart(CartID, Convert.ToInt32(GuestID), trans);
                if (result > 0)
                {
                    trans.Commit();
                }
                else
                {
                    trans.Rollback();
                }
            }
            string[] Result = { count.ToString(), Session["Total"].ToString(), Session["SubTotal"].ToString() };

            return(Json(Result, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        public int UpdateAddress(Ent_GuestAddress model)
        {
            int        result   = 0;
            HttpCookie Guest_ID = Request.Cookies["Guest_ID"];
            int        GuestID  = Guest_ID != null?Convert.ToInt32(Guest_ID.Value.Split('=')[1]) : 0;

            model.Guest_ID = GuestID;
            SafeTransaction trans = new SafeTransaction();

            result = balGuest.UpdateAddress(model, trans);
            if (result > 0)
            {
                trans.Commit();
            }
            else
            {
                trans.Rollback();
            }
            return(result);
        }
示例#9
0
        // GET: Category
        public int SaveProduct(Ent_Product model)
        {
            SafeTransaction trans      = new SafeTransaction();
            DateTime        indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            DateTime        indiTime   = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s"));

            model.Created_Date = indiTime;
            //HttpCookie C_UserID = Request.Cookies["User_ID"];
            //string User_ID = C_UserID != null ? C_UserID.Value.Split('=')[1] : "";
            //model.Created_By = Convert.ToInt32(User_ID);
            model.Created_By = 1;

            HttpFileCollectionBase files = Request.Files;

            if (files.Count > 0)
            {
                HttpPostedFileBase file = files["Product_ImageFile"];
                if (file != null)
                {
                    file.SaveAs(Server.MapPath("~/ProductImages/" + model.Product_Image));
                    model.Product_Image = model.Product_Image;
                }
            }
            else if (!System.IO.File.Exists(Server.MapPath("~/ProductImages/" + model.Product_Image)))
            {
                model.Product_Image = "";
            }
            int i = balProduct.SaveProduct(model, trans);

            if (i > 0)
            {
                trans.Commit();
            }
            else
            {
                trans.Rollback();
            }

            return(i);
        }
示例#10
0
        public int SaveOrganization(Ent_Organization model)
        {
            int             result     = 0;
            SafeTransaction trans      = new SafeTransaction();
            DateTime        indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            DateTime        indiTime   = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s"));

            model.Created_Date = indiTime;
            //HttpCookie User_ID = Request.Cookies["User_ID"];
            //model.Created_By = Convert.ToInt32(User_ID.Value.Split('=')[1]);
            model.Created_By = 1;
            result           = balMaster.SaveOrganization(model, trans);
            if (result > 0)
            {
                trans.Commit();
            }
            else
            {
                trans.Rollback();
            }
            return(result);
        }
示例#11
0
        public ActionResult ActivateAccount(string id)
        {
            SafeTransaction trans  = new SafeTransaction();
            int             result = 0;

            if (id != null)
            {
                Ent_Guest ent        = new Ent_Guest();
                DateTime  indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
                DateTime  indiTime   = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s"));
                ent.Created_Date = indiTime;
                result           = balGuest.ActivateGuest(ent, id, trans);
                if (result > 0)
                {
                    trans.Commit();
                }
                else
                {
                    trans.Rollback();
                }
            }

            string message = "";

            if (result > 0)
            {
                message = "Your Email Has Been Confirmed ! Please Login.";
            }
            else if (result != -2)
            {
                message = "Your Email Not Confirmed.";
            }
            return(RedirectToAction("Register", new { msg = message }));
            //ViewBag.Result = result;
            //return View();
        }
示例#12
0
        //Login
        public int CreateLogin(string Username, string Password)
        {
            int i = 0;

            if (Username != "" && Password != "")
            {
                Ent_Guest entu   = new Ent_Guest();
                Ent_Guest result = new Ent_Guest();
                entu.Guest_Username = Username;
                entu.Guest_Password = Password;
                result = balGuest.SelectLogin(entu);
                if (result != null)
                {
                    if (result.Guest_ID > 0)
                    {
                        //Login User ID
                        HttpCookie Guest_ID = new HttpCookie("Guest_ID");
                        Guest_ID.Values["Guest_ID"] = Convert.ToString(result.Guest_ID);
                        Guest_ID.Expires            = DateTime.Now.AddMinutes(10);
                        Response.Cookies.Add(Guest_ID);

                        //Login User Name
                        HttpCookie Guest_FirstName = new HttpCookie("Guest_FirstName");
                        if (result.Guest_FirstName != "")
                        {
                            Guest_FirstName.Values["Guest_FirstName"] = Convert.ToString(result.Guest_FirstName);
                        }
                        else
                        {
                            Guest_FirstName.Values["Guest_FirstName"] = Convert.ToString(result.Guest_Username);
                        }
                        Guest_FirstName.Expires = DateTime.Now.AddMinutes(10);
                        Response.Cookies.Add(Guest_FirstName);

                        List <Ent_OrderDetail> list = new List <Ent_OrderDetail>();
                        list = balOrder.SelectCart(result.Guest_ID);
                        if (list.Count == 0 && Session["Cart"] != null)
                        {
                            List <Ent_OrderDetail> item  = (List <Ent_OrderDetail>)Session["Cart"];
                            SafeTransaction        trans = new SafeTransaction();
                            int r = balOrder.InsertCartList(item, result.Guest_ID, trans);
                            if (r > 0)
                            {
                                trans.Commit();
                            }
                            else
                            {
                                trans.Rollback();
                            }
                        }
                        else
                        {
                            Session["Cart"]  = list;
                            Session["Total"] = Session["SubTotal"] = list.Sum(y => y.Product_Total);
                        }
                        i = 1;
                    }
                    else
                    {
                        if (Request.Cookies["Guest_ID"] != null)
                        {
                            HttpCookie myCookie = new HttpCookie("Guest_ID");
                            myCookie.Expires = DateTime.Now.AddDays(-1);
                            Response.Cookies.Add(myCookie);
                        }

                        if (Request.Cookies["Guest_FirstName"] != null)
                        {
                            HttpCookie myCookie = new HttpCookie("Guest_FirstName");
                            myCookie.Expires = DateTime.Now.AddDays(-1);
                            Response.Cookies.Add(myCookie);
                        }

                        i = -1;
                    }
                }
                else
                {
                    i = -1;
                }
            }
            else
            {
                i = 0;
            }
            return(i);
        }
示例#13
0
        // GET: Order
        public int AddToCart(int Product_ID)
        {
            Ent_Product ent = new Ent_Product();

            ent = balProduct.SelectProduct(Product_ID);
            HttpCookie Guest_ID = Request.Cookies["Guest_ID"];
            int        GuestID  = Guest_ID != null?Convert.ToInt32(Guest_ID.Value.Split('=')[1]) : 0;

            int qty    = 1;
            int cartid = 0;

            if (Session["Cart"] == null)
            {
                List <Ent_OrderDetail> item = new List <Ent_OrderDetail>();
                item.Add(new Ent_OrderDetail()
                {
                    Product_ID    = Product_ID,
                    Product_Name  = ent.Product_Name,
                    Quantity      = 1,
                    Product_Price = ent.Product_Price - ent.Product_Discount,
                    Product_Image = ent.Product_Image,
                    Product_Total = ent.Product_Price - ent.Product_Discount,
                });
                Session["Cart"]     = item;
                Session["SubTotal"] = ent.Product_Price - ent.Product_Discount;
                Session["Total"]    = ent.Product_Price - ent.Product_Discount;
            }
            else
            {
                List <Ent_OrderDetail> item = (List <Ent_OrderDetail>)Session["Cart"];
                bool has = item.Any(x => x.Product_ID == Product_ID);
                if (has == false)
                {
                    item.Add(new Ent_OrderDetail()
                    {
                        Product_ID    = Product_ID,
                        Product_Name  = ent.Product_Name,
                        Quantity      = 1,
                        Product_Price = ent.Product_Price - ent.Product_Discount,
                        Product_Image = ent.Product_Image,
                        Product_Total = ent.Product_Price - ent.Product_Discount,
                    });
                }
                else
                {
                    item.Where(w => w.Product_ID == Product_ID).ToList().ForEach(i => { i.Quantity = i.Quantity + 1; i.Product_Total = ((i.Quantity) * i.Product_Price); });
                    qty    = item.Where(l => l.Product_ID == Product_ID).FirstOrDefault().Quantity;
                    cartid = 1;
                }
                Session["Cart"]     = item;
                Session["SubTotal"] = Convert.ToInt32(Session["SubTotal"]) + (ent.Product_Price - ent.Product_Discount);
                Session["Total"]    = Convert.ToInt32(Session["Total"]) + (ent.Product_Price - ent.Product_Discount);
            }
            if (GuestID != 0)
            {
                Ent_OrderDetail entP = new Ent_OrderDetail();
                entP.Cart_ID    = cartid;
                entP.Product_ID = Product_ID;
                entP.Quantity   = qty;
                entP.Guest_ID   = Convert.ToInt32(GuestID);
                SafeTransaction trans  = new SafeTransaction();
                int             result = balOrder.InsertCart(entP, trans);
                if (result > 0)
                {
                    trans.Commit();
                }
                else
                {
                    trans.Rollback();
                }
            }


            return(1);
        }
示例#14
0
        public int SaveOrder(Ent_Order model)
        {
            SafeTransaction trans      = new SafeTransaction();
            DateTime        indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            DateTime        indiTime   = Convert.ToDateTime(indianTime.ToString("yyyy-MM-dd h:m:s"));

            model.Created_Date = indiTime;

            HttpCookie Guest_ID = Request.Cookies["Guest_ID"];
            string     GuestID  = Guest_ID != null?Guest_ID.Value.Split('=')[1] : "";

            if (!string.IsNullOrEmpty(GuestID))
            {
                model.Guest_ID = Convert.ToInt32(GuestID);
                Ent_GuestAddress entAddress = new Ent_GuestAddress();
                entAddress = balguest.SelectGuestAddress(Convert.ToInt32(GuestID));
                if (entAddress.Guest_Address1 != "")
                {
                    model.Billing_FirstName = entAddress.First_Name;
                    model.Billing_LastName  = entAddress.Last_Name;
                    model.Billing_Address1  = entAddress.Guest_Address1;
                    model.Billing_Address2  = entAddress.Guest_Address2;
                    model.Billing_State     = entAddress.Guest_State;
                    model.Billing_Town      = entAddress.Guest_Town;
                    model.Billing_Country   = entAddress.Guest_Country;
                }
                else
                {
                    model.Billing_FirstName = model.Shipping_FirstName;
                    model.Billing_LastName  = model.Shipping_LastName;
                    model.Billing_Address1  = model.Shipping_Address1;
                    model.Billing_Address2  = model.Shipping_Address2;
                    model.Billing_State     = model.Shipping_State;
                    model.Billing_Town      = model.Shipping_Town;
                    model.Billing_Country   = model.Shipping_Country;
                }
            }
            else
            {
                model.Guest_ID          = 0;
                model.Billing_FirstName = model.Shipping_FirstName;
                model.Billing_LastName  = model.Shipping_LastName;
                model.Billing_Address1  = model.Shipping_Address1;
                model.Billing_Address2  = model.Shipping_Address2;
                model.Billing_State     = model.Shipping_State;
                model.Billing_Town      = model.Shipping_Town;
                model.Billing_Country   = model.Shipping_Country;
            }

            model.Billing_Email = model.Shipping_Email;
            model.Billing_Phone = model.Shipping_Phone;

            model.Order_SubTotal   = Convert.ToDouble(Session["SubTotal"]);
            model.Order_Shipping   = 0;
            model.Order_Total      = Convert.ToDouble(Session["Total"]);
            model.OrderDetailsList = (List <Ent_OrderDetail>)Session["Cart"];
            int i = balOrder.SaveOrder(model, trans);

            if (i > 0)
            {
                trans.Commit();
                if (model.Payment_COD == 1)
                {
                    string body = string.Empty; var lnkHref = "";
                    if (string.IsNullOrEmpty(GuestID))
                    {
                        lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("TrackOrder", "Order", new { Order_ID = i }) + "' target = '_blank' style = 'color: #fc7ca0;' > here </ a >";
                    }
                    else
                    {
                        lnkHref = "<a href='https://acsadmin.atintellilabs.live/" + @Url.Action("Register", "Login") + "' target = '_blank' style = 'color: #fc7ca0;' > here </ a >";
                    }

                    using (StreamReader reader = new StreamReader(Server.MapPath("~/OrderConfirmation.html")))
                    {
                        body = reader.ReadToEnd();
                    }
                    body = body.Replace("{Url}", lnkHref);

                    Email em = new Email();
                    em.SendConfirmationMail(i, body, "Order Confirmation");

                    if (!string.IsNullOrEmpty(GuestID))
                    {
                        SafeTransaction transac = new SafeTransaction();
                        int             result  = balOrder.DeleteCart(0, Convert.ToInt32(GuestID), transac);
                        if (result > 0)
                        {
                            transac.Commit();
                        }
                        else
                        {
                            transac.Rollback();
                        }
                    }
                    Session["Cart"]     = null;
                    Session["Total"]    = null;
                    Session["SubTotal"] = null;
                    Session["Shipping"] = null;
                }
            }
            else
            {
                trans.Rollback();
            }

            return(i);
        }