示例#1
0
        //private void SavePayment(int requestId)
        //{
        //      //Request.QueryString["referanceNo"];
        //        Payment paymentObj = new Payment();
        //        paymentObj.OrderId = Convert.ToInt32(Request.QueryString["orderId"]);
        //        paymentObj.Amount = 200;
        //        paymentObj.CardNumber = "123";

        //        paymentObj.Mode = 1;
        //        paymentObj.NameOnCard = "Rekha";
        //        paymentObj.TransactionNo = Request.QueryString["referanceNo"];
        //        paymentObj.IsActive = 1;
        //        paymentObj.PaymentDate = DateTime.Now;

        //        //Saving Payment
        //        //.DBAccess.KitchenOnMyPlate.Classes.OrderManagement.SavePayemt(paymentObj, requestId,);
        //}
        void OfflineOnly(PaymentResponse paymentResponse)
        {
            if (paymentResponse.PaymentDone == "0" && (paymentResponse.PaymentMethod == "11" || paymentResponse.PaymentMethod == "12" || paymentResponse.PaymentMethod == "13" || paymentResponse.PaymentMethod == "14"))//Off line only
            {
                if (CommanAction.GetSession() != null)
                {
                    var objtblUser = CommanAction.GetSession();
                    OrderManagement.SavePayemt(Convert.ToInt32(Request.QueryString["requestId"]), 0, Convert.ToInt32(paymentResponse.PaymentMethod), "", "", objtblUser.FirstName);
                }
                Session.Remove("OrderList");
                //Deleting cookies
                if (Request.Cookies["ORDERLIST"] != null)
                {
                    HttpCookie myCookie = new HttpCookie("ORDERLIST");
                    myCookie.Expires = DateTime.Now.AddDays(-1d);
                    Response.Cookies.Add(myCookie);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            loggiedIn        = CommanAction.GetSession().UserId;
            IsPaymentEnabled = Convert.ToInt32(ConfigurationManager.AppSettings["GoToPaymentGateway"]);
            requestId        = Convert.ToInt32(Request.QueryString["requestId"]);

            method = string.IsNullOrEmpty(Request.QueryString["method"])?method:Request.QueryString["method"].ToString();

            if (!IsPostBack)
            {
                if (Request.QueryString["method"] != "11" && Request.QueryString["method"] != "12" && Request.QueryString["method"] != "13" && Request.QueryString["method"] != "14")
                {
                    if (((KitchenOnMyPlate.User)CommanAction.GetSession()).UserType == "N")
                    {
                        btnProcC.Visible = true;
                    }
                }


                if (CommanAction.GetSession().email == null)
                {
                    Response.Redirect("/");
                }
                else
                {
                    if (!string.IsNullOrEmpty(Request.QueryString["LT"]))
                    {
                        FromTopCart = 1;
                    }



                    //if (Session["OrderList"] != null)
                    if (OrderManagement.GetOrderListSession().orders.Count != 0)
                    {
                        var orders = ((OrderList)Session["OrderList"]).orders;

                        CountProducts = orders.Count;


                        if (orders.Count > 0)
                        {
                            delivery_zip.Value = orders[0].Order.pincode.ToString();

                            //txtLocation.DataSource  = DBAccess.GetDeliveryAreaForZip(Convert.ToInt32(delivery_zip.Value));
                            //txtLocation.DataTextField = "Location";
                            //txtLocation.DataValueField = "Id";
                            //txtLocation.DataBind();
                            //txtLocation.Items.Insert(0, new ListItem { Selected = true, Value = "999", Text = "" });
                            //txtLocation.SelectedIndex = 0;
                        }

                        //CHANGES on 22/01/16-
                        //if (("400601,400602,400603,400703,400703").Contains(orders[0].Order.pincode.ToString()))
                        //{
                        //txtLocation.DataSource = DBAccess.GetDeliveryAreaForZip(Convert.ToInt32(delivery_zip.Value));
                        //txtLocation.DataTextField = "Location";
                        //txtLocation.DataValueField = "Id";
                        //txtLocation.DataBind();
                        //txtLocation.Items.Add(new ListItem { Selected = true, Value = "0", Text = "--Select Area--" });
                        //}
                        //else
                        //{
                        //    txtLocation.Items.Add(new ListItem { Selected = true, Value = "999", Text = "Mumbai"});
                        //    txtLocation.Disabled = true;
                        //}

                        foreach (var ord in orders)
                        {
                            pincode       = ord.Order.pincode ?? 0;
                            order_id.Text = ord.Order.RequestId.ToString();
                            if (amount.Text == "")
                            {
                                amount.Text = "0";
                            }
                            amount.Text = (Convert.ToDecimal(amount.Text) + ord.payment.Amount + ord.payment.DeliveryChrg + ord.payment.TrnChrg).ToString();
                        }
                    }

                    string utype = ((KitchenOnMyPlate.User)CommanAction.GetSession()).UserType;
                    if (utype != "N")//Not setting for admin
                    {
                        var shpbill = DBAccess.GetShippingBillingByUserId(loggiedIn, pincode);

                        if (shpbill.Id != 0)
                        {
                            delivery_name.Value = shpbill.FirstName;

                            if (shpbill.LastName.Trim() == "") //Note last name is using as emailid
                            {
                                txtLastName.Value = CommanAction.GetSession().email;
                            }
                            else
                            {
                                txtLastName.Value = shpbill.LastName;
                            }

                            if (Session["USER"] != null && shpbill.LastNameB.Trim() == "") //Note last name is using as emailid
                            {
                                txtLastNameB.Value = CommanAction.GetSession().email;
                            }
                            else
                            {
                                txtLastName.Value = shpbill.LastName;
                            }

                            delivery_tel.Value     = shpbill.mobile;
                            txtCompanyName.Value   = shpbill.CompanyName;
                            delivery_address.Value = shpbill.Address.Replace("$", ", ");
                            var address = shpbill.Address.Split('$');

                            if (address.Length > 2)
                            {
                                txtFlat.Value     = address[0];
                                txtBuilding.Value = address[1];
                                txtStreet.Value   = address[2];

                                txtFlatB.Value     = address[0];
                                txtBuildingB.Value = address[1];
                                txtStreetB.Value   = address[2];
                            }

                            if (address.Length > 3)
                            {
                                txtLocation.Value = address[3];
                            }


                            txtLandMark.Value   = shpbill.LandMark;
                            delivery_city.Value = shpbill.City;
                            //delivery_state.Value = shpbill.;
                            delivery_zip.Value = shpbill.Pincode;

                            billing_name.Value    = delivery_name.Value;
                            txtLastNameB.Value    = shpbill.LastName;
                            billing_tel.Value     = shpbill.mobile;
                            txtCompanyNameB.Value = shpbill.CompanyName;
                            billing_address.Value = shpbill.Address.Replace("$", ", ");



                            txtLandMarkB.Value = shpbill.LandMark;
                            billing_city.Value = shpbill.City;
                            //delivery_state.Value = shpbill.;
                            billing_zip.Value = shpbill.Pincode;
                            // txtLocation.Value = DBAccess.CheckDeliveryArea( Convert.ToInt32(shpbill.Pincode)).Location;
                        }
                        else
                        {//First time withoud shipping address
                            if (CommanAction.GetSession().email != "")
                            {
                                delivery_name.Value = CommanAction.GetSession().FirstName;

                                if (CommanAction.GetSession().UserType == "F")
                                {
                                    txtLastName.Value = string.Empty;
                                }
                                else
                                {
                                    txtLastName.Value    = CommanAction.GetSession().email;
                                    txtLastName.Disabled = true;
                                    hdnEmail.Value       = CommanAction.GetSession().email;
                                }

                                txtLastNameB.Value = CommanAction.GetSession().email;


                                delivery_tel.Value = CommanAction.GetSession().mobile;


                                txtLastNameB.Disabled = true;
                            }
                        }
                    }
                }

                ShowOrderDetails();

                FinalOrder = OrderManagement.GetPlacedOrderFinalHTML();
            }
        }
        protected void btnSub_Click(object sender, EventArgs e)
        {
            Thread.Sleep(7000);

            if (DataAccess.DBAccess.CheckAddressForRequestNo(requestId) == 0)
            {
                return;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["method"]) && Request.QueryString["method"] != "11" && Request.QueryString["method"] != "12" && Request.QueryString["method"] != "13" && Request.QueryString["method"] != "14")  //It is for online only - should not be called in offline. 11 means offf line
            {
                //It is for online only - should not be called in offline.
                foreach (var name in Request.Form.AllKeys)
                {
                    if (name != null)
                    {
                        if (!name.Contains("btnProcC") && !name.Contains("bll") && !name.Contains("txtLandMark") && !name.Contains("txtCompanyName") && !name.Contains("txtExistingUserName") && !name.Contains("txtFlat") && !name.Contains("txtStreet") && !name.Contains("txtBuilding") && !name.Contains("txtLocation") && !name.Contains("hdnEmail") && !name.Contains("btnSub"))
                        {
                            if (!name.Replace("ctl00$ContentPlaceHolder1$", "").StartsWith("_"))
                            {
                                ccaRequest = ccaRequest + name.Replace("ctl00$ContentPlaceHolder1$", "") + "=" + Request.Form[name] + "&";

                                /* Response.Write(name + "=" + Request.Form[name]);
                                 * Response.Write("</br>");*/
                            }
                        }
                    }
                }


                //if ( Request.QueryString["method"] == "11")//Off line
                //{
                //    Response.Redirect("ConfirmationPage.aspx?method=" + Request.QueryString["method"]+"&requestId"+Request.QueryString["requestId"]);
                //}
                //else
                //{
                //Online
                if (CommanAction.GetSession() != null)
                {
                    if (hdnEmail.Value != "")
                    {
                        ccaRequest = ccaRequest + "billing_email=" + hdnEmail.Value + "&"; //Note : last name is using like email id //((User)Session["USER"]).email + "&";
                    }
                    else
                    {
                        ccaRequest = ccaRequest + "billing_email=" + txtLastName.Value + "&"; //Note : last name is using like email id //((User)Session["USER"]).email + "&";
                    }
                }


                ccaRequest = ccaRequest + "billing_country=India&";
                ccaRequest = ccaRequest + "delivery_country=India&";

                strEncRequest = ccaCrypto.Encrypt(ccaRequest, workingKey);


                DBAccess.setPaymentAsFailed(requestId); //Online payment Mark it as failed

                Session.Remove("OrderList");
                //Deleting cookies
                if (Request.Cookies["ORDERLIST"] != null)
                {
                    HttpCookie myCookie = new HttpCookie("ORDERLIST");
                    myCookie.Expires = DateTime.Now.AddDays(-1d);
                    Response.Cookies.Add(myCookie);
                }
                if (Convert.ToInt32(ConfigurationManager.AppSettings["GoToPaymentGateway"]) == 1)
                {
                    Response.Redirect("ccavRequestHandler.aspx?ED=" + strEncRequest);
                }
                else
                {
                    Response.Redirect("Stub.aspx?requestId=" + requestId);
                    //window.location.href = "Stub.aspx?requestId=" + requestId;
                }

                // Response.Redirect("ccavRequestHandler.aspx?ED=" + strEncRequest);
                //window.location.href = "Stub.aspx?requestId=" + requestId;
                //}
            }
            else
            {
                Response.Redirect("ConfirmationPage.aspx?method=" + method + "&referanceNo=123&PaymentDone=0&requestId=" + requestId);

                //window.location = "ConfirmationPage.aspx?method=" + method + "&referanceNo=123&PaymentDone=0&requestId=" + requestId;

                //
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //HttpContext.Current.Response.ClearHeaders();
            //("Location",
            if (!Request.Url.ToString().ToLower().Contains("www") && !Request.Url.ToString().ToLower().Contains("localhost"))
            {
                HttpContext.Current.Response.Status = "301 Moved Permanently";
                //HttpContext.Current.Response.AddHeader("Location","http://www." + ConfigurationManager.AppSettings["SiteName"].ToString());
                HttpContext.Current.Response.AddHeader("Location",
                                                       Request.Url.ToString().ToLower().Replace("http://" + ConfigurationManager.AppSettings["SiteName"].ToString(), "http://www." + ConfigurationManager.AppSettings["SiteName"].ToString()));

                Response.RedirectPermanent("http://www." + ConfigurationManager.AppSettings["SiteName"].ToString());
            }

            if (!IsPostBack)
            {
                if (Request != null)
                {
                    if (Request.Cookies["UserName"] != null && Request.Cookies["Password"] != null)
                    {
                        txtExistingUserName.Value = Request.Cookies["UserName"].Value;
                    }
                }

                if (!HttpContext.Current.Request.Url.Host.ToUpper().Contains("WWW") && HttpContext.Current.Request.Url.Host.ToUpper() != "LOCALHOST")
                {
                    Response.Redirect("http://www.kitchenonmyplate.com/");
                }
                //Read the cookie from Request.
                HttpCookie myCookie = HttpContext.Current.Request.Cookies["USERMART"];
                if (myCookie != null)
                {
                    if (!string.IsNullOrEmpty(myCookie.Values["EMAIL"]))
                    {
                        if (Session["USER"] == null)
                        {
                            DataAccess.DBAccess.CreateSession(myCookie.Values["EMAIL"]);
                        }
                    }
                }



                if (Session["USER"] != null)
                {
                    var userObj = ((User)Session["USER"]);
                    loggiedIn = userObj.UserId;

                    login.Style.Add("display", "none");
                    aRegister.Style.Add("display", "none");

                    //login.Visible = false;
                    //aRegister.Visible = false;
                    loggendUser.Style.Remove("display");
                    logOut.Style.Remove("display");
                    aMyOrders.Style.Remove("display");

                    //logOut.Visible = true;
                    //aMyOrders.Visible = true;

                    loggendUser.Text = "Hi, " + userObj.FirstName;

                    VarName   = userObj.FirstName + " " + userObj.LastName;
                    VarMobile = userObj.mobile;
                    VarEmail  = userObj.email;

                    //KOMP

                    //loggendUser.Text = "Welcome " + ((User)Session["USER"]).FirstName + " !!";
                    //loggendUser.Visible = true;

                    //divLogout.Visible = true;
                    //divLogout.Style.Remove("display");

                    //divLogin.Visible = false;
                    //loggendUser.Visible = true;
                    //Page.ClientScript.RegisterStartupScript(typeof(Page), "dfSite", " $('#ctl00_divLogin').hide();$('#ctl00_divLogout,#ctl00_loggendUser').show();", false);

                    if (CommanAction.GetSession().UserType == "N") // If admin
                    {
                        LoggedInUserType = "A";
                    }

                    LoggedInUserType = CommanAction.GetSession().UserType;
                    //divLogin.Visible = false;
                    //divLogout.Visible = true;
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "dfSite1", " $('#ctl00_loggendUser').hide();", true);
                    //loggendUser.Visible = false;
                }


                //Placed Orders only , not saved in db
                string PlacedOrders1 = OrderManagement.GetPlacedOrders().Split('$')[0];
                CartSaved.Text = !string.IsNullOrEmpty(PlacedOrders1) ? PlacedOrders1 : "";

                if (HttpContext.Current.Session["OrderList"] != null)
                {
                    OrderList orders = (OrderList)HttpContext.Current.Session["OrderList"];
                    if (orders.orders.Count > 3)
                    {
                        PlacedOrders.Style.Add("height", "550px");
                        PlacedOrders.Style.Add("overflow-y", "auto");
                    }
                }

                string pType = string.IsNullOrEmpty(Request.QueryString["il"]) ? string.Empty : Request.QueryString["il"];
                if (!((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("default"))
                {
                    divSlider.Visible = false;
                }

                if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("default"))
                {
                    pageId = 0;
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("about"))
                {
                    pageId = 1;
                    if (Request.QueryString["id"] == "ourmission")
                    {
                        subpageId = "abt1";
                    }
                    else if (Request.QueryString["id"] == "ourvision")
                    {
                        subpageId = "abt2";
                    }
                    else if (Request.QueryString["id"] == "ourvalues")
                    {
                        subpageId = "abt3";
                    }
                    else if (Request.QueryString["id"] == "ourlogo")
                    {
                        subpageId = "abt3";
                    }
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("service") && pType == "1")
                {
                    pageId = 2;
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("yourorder"))
                {
                    pageId = 3;
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("service") && pType == "0")
                {
                    pageId = 4;
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("corporate"))
                {
                    pageId    = 5;
                    subpageId = "asub1";
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("school"))
                {
                    pageId    = 5;
                    subpageId = "asub2";
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("event"))
                {
                    pageId    = 5;
                    subpageId = "asub3";
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("contactus"))
                {
                    subpageId = "acont";
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("myorders"))
                {
                    subpageId = "aMyOrders";
                }
                else if (((System.Web.UI.Control)(ContentPlaceHolder1)).Page.ToString().Contains("howitworks"))
                {
                    subpageId = "achow";
                }



                SetMenu();
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["OrderList"] != null)
            {
                //public JavaScriptSerializer javaSerial = new JavaScriptSerializer();
                //HttpContext.Current.Session["OrderList"] = orders;
                orderlst = ((OrderList)HttpContext.Current.Session["OrderList"]).orders.ToArray();

                //foreach (var itm in orderlst)
                //{
                //    itm.Order.OrderDate = itm.Order.OrderDate.Value.Date;
                //}
                if (orderlst.Length > 0)
                {
                    txtPinCode.Value    = orderlst[0].Order.pincode.ToString();
                    txtPinCode.Disabled = true;
                }
            }


            //if (Session["USER"] != null)
            //{
            loggiedIn    = CommanAction.GetSession().UserId;
            minDateAdmin = (CommanAction.GetSession().UserType == "N") ? 3 : 3;    //4 : 0;

            //If requst order from tomorrow start
            if (Session["ORDERFROMTOMORROW"] != null)
            {
                DateTime serverTime = DateTime.Now;
                DateTime utcTime    = serverTime.ToUniversalTime();
                // convert it to Utc using timezone setting of server computer
                TimeZoneInfo tzi       = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
                DateTime     localTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, tzi);

                string date = Session["ORDERFROMTOMORROW"].ToString().Trim();
                int    dd   = Convert.ToInt32(date.ToString().Substring(0, 2)) / 2;
                int    mm   = Convert.ToInt32(date.ToString().Substring(2, 2)) / 2;
                int    yy   = Convert.ToInt32(date.ToString().Substring(4, 2)) / 2;

                if ((dd.ToString().PadLeft(2, '0') + mm.ToString().PadLeft(2, '0') + yy.ToString().PadLeft(2, '0')) == localTime.ToString("ddMMyy"))
                {
                    minDateAdmin = 3;
                }
            }
            else
            {
                var zone                = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
                var timeInIndia         = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, zone);
                var timeInIndiaAsString = timeInIndia.ToString("hh:mm tt", CultureInfo.InvariantCulture);

                //start from 1 PM
                if (timeInIndia.Hour > 12 && timeInIndiaAsString.Contains("PM"))
                {
                    minDateAdmin = 2;
                }
                else
                {
                    minDateAdmin = 3;
                }
            }
            //If requst order from tomorrow end


            //}

            var item = Page.RouteData.Values["itm"] as string;
            var il   = Page.RouteData.Values["il"] as string;

            if (!string.IsNullOrEmpty(Request.QueryString["OrderRqst"]))
            {
                RenewRequest = DBAccess.GetOrderedItemNonCust(Convert.ToInt32(Request.QueryString["OrderRqst"])).ToString();
            }

            if (!string.IsNullOrEmpty(il))
            {
                IsLunch = (il.ToUpper() == "LUNCH");
            }


            if (!IsPostBack)
            {
                SetHoidays();
                BindLocation();
                SetItems();

                SetConfig();
            }
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PaymentResponse objPaymentResponse = new PaymentResponse();

            if (Session["PaymentResponse"] != null)
            {
                objPaymentResponse = (PaymentResponse)Session["PaymentResponse"];
                Session.Remove("PaymentResponse");
            }
            else if (Request.QueryString["method"] == "11" || Request.QueryString["method"] == "12" || Request.QueryString["method"] == "13" || Request.QueryString["method"] == "14")//Offline
            {
                objPaymentResponse.PaymentMethod = Request.QueryString["method"];
                objPaymentResponse.PaymentDone   = "0";
                objPaymentResponse.RequestId     = Request.QueryString["requestId"];
            }

            OfflineOnly(objPaymentResponse);

            if (objPaymentResponse.PaymentDone == "1" || (objPaymentResponse.PaymentDone == "0" && objPaymentResponse.PaymentMethod == "11" || objPaymentResponse.PaymentMethod == "12" || objPaymentResponse.PaymentMethod == "13" || objPaymentResponse.PaymentMethod == "14"))
            {
                //var orderDTO = (OrderList)HttpContext.Current.Session["OrderList"];
                var requesedItems = DBAccess.GetRequestedItems(Convert.ToInt32(objPaymentResponse.RequestId));
                //gridProduct.DataBind();
                //lblOrderCode.Text = Request.QueryString["orderId"];
                lblPMethod.Text = GetPaymentMethod(objPaymentResponse.PaymentMethod);


                if (objPaymentResponse.PaymentMethod == "11" || objPaymentResponse.PaymentMethod == "12" || objPaymentResponse.PaymentMethod == "13" || objPaymentResponse.PaymentMethod == "14") //Offline message
                {
                    lblPaymentMessage.Text = " Thank you for placing your order with Kitchen On My Plate. Here are your Order details";
                    offlineBankDtl.Visible = true;
                }

                //lblTotal.Text = orderDTO.payment.Amount.ToString();


                //New

                // SavePayment(Convert.ToInt32(Request.QueryString["requestId"]));
                Decimal subTotal      = 0;
                Decimal tranChrg      = 0;
                Decimal deliveryChrg  = 0;
                string  colspan       = "0";
                string  startdate     = string.Empty;
                string  productName   = "Customized Meals";
                string  Quantity      = string.Empty;
                string  mealstartdate = string.Empty;
                string  LunchDinner   = string.Empty;
                string  OrderNumbers  = string.Empty;
                foreach (var item in requesedItems)
                {
                    productName  = "Customized Meals";
                    OrderNumbers = (string.IsNullOrEmpty(OrderNumbers))? item.orderId.ToString():(OrderNumbers + "," + item.orderId.ToString());

                    LunchDinner = item.IsTiffin == 1 ? "Lunch" : "Dinner";

                    if (item.nonCustomized == 0)
                    {
                        tbOrders.Text = tbOrders.Text + "<tr class='divRow dataHeader'><td><b>MEAL NAME</b></td><td><b>PRICE</b></td><td><b>QUANTITY</b></td><td><b>TOTAL</b></td></tr>";
                        colspan       = "3";
                    }
                    else
                    {
                        tbOrders.Text = tbOrders.Text + "<tr class='divRow dataHeader'><td><b>MEAL DETAILS</b></td><td><b>AMOUNT DETAILS</b></td></tr>";
                        colspan       = "0";
                    }


                    int indx = 0;
                    foreach (var odr in item.orderedItems)
                    {
                        indx++;

                        if (indx == 1)
                        {
                            startdate     = odr.DeliverDate.ToString();
                            mealstartdate = odr.DeliverDate.ToString();
                        }
                        if (item.nonCustomized == 0)
                        {    //Customized
                            tbOrders.Text = tbOrders.Text + "<tr class='divRow divRowData'><td>" + odr.ProductName + ".</td><td>" + odr.Price + "</td><td>1</td><td>" + odr.Price + "</td></tr>";
                        }
                        else
                        {    //Tiffin
                            if (indx == 1)
                            {
                                tbOrders.Text = tbOrders.Text + "<tr class='divRow'><td style='width:70%;' id='divPNAME'> <span class='price'>" + odr.ProductName + "</span></td><td style='width:30%;' align='center'><strong>" + item.orderedItems.Count * Convert.ToDecimal(odr.Price) + "</strong></td></tr>";
                                productName   = odr.ProductName;
                            }
                        }
                    }

                    Quantity     = item.orderedItems.Count.ToString();
                    subTotal     = subTotal + item.subTotal;
                    deliveryChrg = deliveryChrg + item.deliveryCharges;
                    tranChrg     = tranChrg + item.transCharges;

                    //It is with top details
                    tbOrders1.Text = tbOrders1.Text + "<tr class='divRow cstItem' id='Ord11" + item.orderId.ToString() + "' align='center'></td><td align='center'  style=''>" + item.orderId.ToString() + "</td><td  style='width:40%;'  align='center'> <span>" + productName + "</span></td><td align='center'><span>" + item.orderedItems.Count + "</span></td><td style='' align='center'><span class=''>" + Convert.ToDateTime(mealstartdate).ToString("dd/MM/yy") + "</span></td><td style='' align='center'><span id='' class=''>" + LunchDinner + "</span></td></tr>";

                    // tbOrders.Text = tbOrders.Text + "<tr class='divRow' align='right'><td colspan='" + colspan + "'><b>Sub Total &nbsp;&nbsp; </b> </td><td align='center'><b>" + item.subTotal + "</b></td></tr>";
                    // tbOrders.Text = tbOrders.Text + "<tr class='divRow' align='right'><td colspan='" + colspan + "'><b>Delivery Charges&nbsp;&nbsp;</b>  </td><td align='center'><b>" + item.deliveryCharges + "</b></td></tr>";

                    if (item.transCharges > 0)
                    {
                        //if (objPaymentResponse.PaymentMethod == "14") //Cash pickup option of off line
                        //{
                        //    tbOrders.Text = tbOrders.Text + "<tr class='divRow' align='right'><td colspan='" + colspan + "'><b>Cash Pick up Charges&nbsp;&nbsp;</b>  </td><td align='center'><b>" + item.transCharges + "</b></td></tr>";
                        //}
                        //else
                        //{
                        //    tbOrders.Text = tbOrders.Text + "<tr class='divRow' align='right'><td colspan='" + colspan + "'><b>Online Processing Charges&nbsp;&nbsp;</b>  </td><td align='center'><b>" + item.transCharges + "</b></td></tr>";
                        //}
                    }

                    //tbOrders.Text = tbOrders.Text + "<tr class='divRow' align='right'  ><td colspan='" + colspan + "'><span style='font-family:RobotoBlack' >Amount&nbsp;&nbsp;</span>  </td><td align='center' ><span style='font-family:RobotoBlack' >" + item.grandTotal + "</span></td></tr>";
                    tbOrders.Text = tbOrders.Text + "<tr class='divRow' align='right'  ><td colspan='" + colspan + "'><span style='font-family:RobotoBlack' >Amount&nbsp;&nbsp;</span>  </td><td align='center' ><i class='fa fa-inr'></i><span style='font-family:RobotoBlack' >" + item.subTotal + "</span></td></tr>";

                    spnRqst.InnerText = spnRqst.InnerText == "" ? item.orderId.ToString() : (spnRqst.InnerText + ", " + item.orderId.ToString());
                }


                spnSubTotal.InnerHtml = "<i class='fa fa-inr'></i>" + subTotal.ToString();
                spnDelivery.InnerHtml = "<i class='fa fa-inr'></i>" + deliveryChrg.ToString();

                trTran.Visible = tranChrg > 0;

                //string transactionStr = "";
                string transactionStr = tranChrg.ToString();
                if (objPaymentResponse.PaymentMethod == "14") //Cash pickup option of off line
                {
                    strOnln.InnerHtml = "Cash Pick up Charges&nbsp;&nbsp;&nbsp;";
                    //Cash check pickup
                    //var config = DBAccess.GetConfig();
                    //tranChrg = Convert.ToInt32(tranChrg + config.CashPickUp ?? 0);
                    tranChrg       = Convert.ToInt32(tranChrg);
                    transactionStr = tranChrg + ".00";;
                }
                spnTrns.InnerHtml = "<i class='fa fa-inr'></i>" + transactionStr.ToString();

                spnOnlineGrandTotal.InnerHtml = "<i class='fa fa-inr'></i>" + (subTotal + deliveryChrg + tranChrg).ToString();

                if (!(objPaymentResponse.PaymentMethod == "11" || objPaymentResponse.PaymentMethod == "12" || objPaymentResponse.PaymentMethod == "13" || objPaymentResponse.PaymentMethod == "14")) //online message
                {
                    lblPaymentMessage.Text = "Thank you for placing your order with Kitchen On My Plate.  We have received the payment for the amount " + spnOnlineGrandTotal.InnerText + "    on " + DateTime.Today.ToString("dd/MM/yy") + " for the Order No. " + OrderNumbers + ". Here are your Order details";
                }


                var shippingBilling = DBAccess.GetShippingBilling(Convert.ToInt32(objPaymentResponse.RequestId));

                string strlocation = DBAccess.CheckDeliveryArea(Convert.ToInt32(shippingBilling.Pincode)).Location;

                strongBilling.InnerText = shippingBilling.Address.Replace("$", ", ") + ", " + strlocation;

                strlocation = DBAccess.CheckDeliveryArea(Convert.ToInt32(shippingBilling.PincodeB)).Location;

                strongDelivery.InnerText = shippingBilling.AddressB.Replace("$", ", ") + ", " + strlocation;



                if (CommanAction.GetSession() != null)
                {
                    var objtblUser = CommanAction.GetSession();

                    //Order Summary start
                    //if (Request.QueryString["method"] == "5")
                    //{
                    divOff.Visible    = true;
                    spnName.InnerText = objtblUser.FirstName;
                    //spnRqst.InnerText = objPaymentResponse.RequestId;// Request.QueryString["requestId"];
                    spnSA.InnerText          = shippingBilling.Address.Replace("$", ", ") + shippingBilling.LandMark + " " + shippingBilling.Pincode;//+shippingBilling.City;
                    spnBA.InnerText          = shippingBilling.Address.Replace("$", ", ") + shippingBilling.LandMark + " " + shippingBilling.Pincode;
                    spnRQSTDATE.InnerText    = DateTime.Today.ToString("dd/MM/yy");
                    spnPName.InnerText       = productName;
                    spnQuantity.InnerText    = Quantity;
                    spnMealPP.InnerText      = Quantity + " days";
                    spnPaymentMode.InnerText = GetPaymentMethod(objPaymentResponse.PaymentMethod);
                    decimal ds = spnPaymentAmount.InnerHtml == "" ? 0 : Convert.ToDecimal(spnPaymentAmount.InnerHtml);
                    spnPaymentAmount.InnerHtml = (ds + subTotal + deliveryChrg + tranChrg).ToString();;
                    spnPaymentStatus.InnerText = GetStatusById(objPaymentResponse.PaymentDone);
                    spnaMealSDate.InnerText    = Convert.ToDateTime(mealstartdate).ToString("dd/MM/yy");
                    spnaMealType.InnerText     = LunchDinner;
                    //}
                    //Order Summary end

                    #region Send Mail

                    string content = string.Empty;

                    string filepath = "~/Email/Post.htm";
                    //New user
                    StringBuilder sbContent = new StringBuilder();
                    StreamReader  rdr       = new StreamReader(HttpContext.Current.Server.MapPath(filepath));
                    string        strLine   = "";
                    while (strLine != null)
                    {
                        strLine = rdr.ReadLine();
                        if ((strLine != null) && (strLine != ""))
                        {
                            sbContent.Append("\n" + strLine);
                        }
                    }
                    rdr.Close();

                    string site = ConfigurationManager.AppSettings["SiteName"].ToString();
                    content = sbContent.ToString();
                    //content = content.Replace("$REQ$", PostType);
                    //content = content.Replace("$ID$", ID);
                    var sbOff = new StringBuilder();
                    divOff.RenderControl(new HtmlTextWriter(new StringWriter(sbOff)));
                    //sbOff.Replace("hideonemail", "display:none");


                    content = content.Replace("$ORDERSUMMARY$", sbOff.ToString());

                    //All Orders Start
                    var sbOff1 = "<br/><br/><table class='tableCart tbl' cellspacing='1' width='100%' align='center' cellpadding='5' ><thead>" +
                                 "<tr class='divRow dataHeader' style='background:#F16822;color:#fff;font-family:RobotoBold;font-size:1em; ' ><td>ORDER#</td><td>PRODUCT</td><td>QUANTITY</td><td>START DATE</td><td>MEAL TYPE</td></tr>" +
                                 "</thead><tbody>" + tbOrders1.Text + "</tbody></table>";
                    content = content.Replace("$ALLORDERS$", sbOff1);
                    //All Orders End



                    var sb = new StringBuilder();
                    divFinal.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
                    content = content.Replace("$REQ$", sb.ToString());
                    content = content.Replace("$NAME$", objtblUser.FirstName + " " + objtblUser.LastName);
                    content = content.Replace("$SITE$", site);

                    content = content.Replace("RobotoBlack", "Arial");
                    content = content.Replace("RobotoBold", "Arial");
                    content = content.Replace("Roboto", "Arial");

                    content = content.Replace("images/rs3.png", "http://www.kitchenonmyplate.com/images/rs3.png");
                    content = content.Replace("hideonemail", "display:none;max-height: 0px; font-size: 0px; overflow: hidden; mso-hide: all");
                    content = content.Replace("<strong>", "<span>");
                    content = content.Replace("</strong>", "</span>");
                    content = content.Replace("h1>", "h2>");
                    content = content.Replace("<h1", "<h2");


                    content = content.Replace("<i class='fa fa-inr'></i>", "Rs. ");



                    //content = content.Replace("class", "style");
                    //content = content.Replace("page-titleSmallCust", "color:#4b220c; text-transform:uppercase; font-family:'Arial'; font-weight:bold;border-bottom:1px solid #c8c6c6; padding:10px 0 10px 25px ; font-size:25px; margin-top:0px;background:#EEEEEE !important;");
                    //content = content.Replace("OrderBox", "display:none");
                    //content = content.Replace("ProcesBoxInner", "height:auto; padding:0px 25px 10px 10px;text-align: justify; text-justify: inter-word;");
                    //content = content.Replace("ProcessBox", "width:100%;height:auto;border:1px solid #c8c6c6;padding-bottom:10px;");
                    //content = content.Replace("tbl", "width:100%;height:auto;border:1px solid #c8c6c6;");
                    //content = content.Replace("divRowHeader", "font-weight:bold; color:Black; font-size:0.85em;");
                    //content = content.Replace("<table", "<table style='border-collapse:collapse; border-spacing:0;' border='1' ");
                    //content = content.Replace("priceTotaltxt", "font-weight:700; font-size:24px; color: #006400;");
                    //content = content.Replace("priceTotal", "font-size:30px; color: #006400; padding-right:25px;");
                    //content = content.Replace("price", "font-weight:700; font-size:1.2em; color: #006400;");

                    //content = content.Replace("CUSTBOX", "");
                    //content = content.Replace("emailH5", "font-size:14px;color:#f37624;font-family:Arial;");

                    content = content.Replace(">01<", "><");
                    content = content.Replace(">03<", "><");


                    if (!string.IsNullOrEmpty(objtblUser.email))
                    {
                        MailHelper.SendMailMessage("", objtblUser.email, string.Empty, string.Empty, "Thanks For Placing Order", content);
                        AutoServices.SendeMailToUs("Copy:Thanks For Placing Order", content);
                    }

                    trlist.Visible = true;
                    #endregion
                }

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

            Session.Remove("OrderList");
            //Deleting cookies
            if (Request.Cookies["ORDERLIST"] != null)
            {
                HttpCookie myCookie = new HttpCookie("ORDERLIST");
                myCookie.Expires = DateTime.Now.AddDays(-1d);
                Response.Cookies.Add(myCookie);
            }
        }
示例#7
0
        protected double chkCashPickUpPers     = 0; //in percent

        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["OrderList"] != null)
            {
                //HttpContext.Current.Session["OrderList"] = orders;
                orderlst = ((OrderList)HttpContext.Current.Session["OrderList"]).orders.ToArray();
                if (orderlst.Length > 0)
                {
                    txtPinCode.Value    = orderlst[0].Order.pincode.ToString();
                    txtPinCode.Disabled = true;
                }
            }

            Page.Title           = "Best Online Customized Tiffin Service in Mumbai - kitchenonmyplate.com";
            Page.MetaDescription = "KOMP is offers online Customised tiffin service in Mumbai. Choose Customised meal and Call us or email, we will be at your place to serve your delicious favorite meal.";
            Page.MetaKeywords    = "Best Online Customized Tiffin Service in Mumbai, Customized Tiffin Service, Customised Meal Services, Stuffed Paratha Plate, Mouthwatering Biryani Plate, Special Khichdi Plate";


            if (CommanAction.GetSession() != null)
            {
                loggiedIn    = CommanAction.GetSession().UserId;
                minDateAdmin = (CommanAction.GetSession().UserType == "N") ? 3 : 3;
            }

            //If requst order from tomorrow start
            if (Session["ORDERFROMTOMORROW"] != null)
            {
                DateTime serverTime = DateTime.Now;
                DateTime utcTime    = serverTime.ToUniversalTime();
                // convert it to Utc using timezone setting of server computer
                TimeZoneInfo tzi       = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
                DateTime     localTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, tzi);

                string date = Session["ORDERFROMTOMORROW"].ToString().Trim();
                //int date = Convert.ToInt32(Session["ORDERFROMTOMORROW"]);
                int dd = Convert.ToInt32(date.ToString().Substring(0, 2)) / 2;
                int mm = Convert.ToInt32(date.ToString().Substring(2, 2)) / 2;
                int yy = Convert.ToInt32(date.ToString().Substring(4, 2)) / 2;

                if ((dd.ToString().PadLeft(2, '0') + mm.ToString().PadLeft(2, '0') + yy.ToString().PadLeft(2, '0')) == localTime.ToString("ddMMyy"))
                {
                    minDateAdmin = 3;
                }
            }
            else
            {
                var zone                = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
                var timeInIndia         = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, zone);
                var timeInIndiaAsString = timeInIndia.ToString("hh:mm tt", CultureInfo.InvariantCulture);

                //start from 1 PM
                if (timeInIndia.Hour > 12 && timeInIndiaAsString.Contains("PM"))
                {
                    minDateAdmin = 2;
                }
                else
                {
                    minDateAdmin = 3;
                }
            }
            //If requst order from tomorrow end

            var item = Page.RouteData.Values["itm"] as string;

            if (!string.IsNullOrEmpty(item))
            {
                selectedItem = item;
            }


            if (!IsPostBack)
            {
                BindLocation();
                SetItems();
                SetHoidays();
                SetConfig();
            }

            if (Request.QueryString["sc"] != null)
            {
                scPostion = Request.QueryString["sc"];
            }
        }