示例#1
0
        public static Config GetConfig()
        {
            Config config = new Config();

            if (!CacheHelper.Get("Config", out config))
            {
                using (DBKOMPDataContext db = new DBKOMPDataContext())
                {
                    config = (from w in db.Configs select w).First();
                    CacheHelper.Add(config, "Config", 2000);
                }
            }

            return(config);
        }
示例#2
0
        public static List <tblLocation> GetLocations()
        {
            List <tblLocation> locations = new List <tblLocation>();

            if (!CacheHelper.Get("Location", out locations))
            {
                using (DBKOMPDataContext db = new DBKOMPDataContext())
                {
                    locations = (from w in db.tblLocations orderby w.CityDivisionID orderby w.CityDivisionID, w.Location select w).ToList();
                    CacheHelper.Add(locations, "Location", 2000);
                }
            }

            return(locations);
        }
示例#3
0
        public static int DeltedWeeklyMenuItem(int id)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                if (id != 0)
                {
                    db.WeeklyMenus.DeleteOnSubmit(db.WeeklyMenus.Where(w => w.Id == id).First());
                }

                db.SubmitChanges();
                CacheHelper.Clear("WEEKLYMENU");
                CacheHelper.Clear("WEEKLYMENUA");
            }

            return(id);
        }
示例#4
0
        public static string GetAvailability(int id)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                var avlStr = string.Empty;
                var aval   = (from w in db.MenuItems where w.Id == id select w).First();
                var list   = aval.AvailableDay.Split(',');
                for (var i = 0; i < list.Length; i++)
                {
                    if (avlStr != string.Empty)
                    {
                        avlStr = avlStr + " | ";
                    }

                    if (list[i] == "1")
                    {
                        avlStr = "Mo";
                    }
                    else if (list[i] == "2")
                    {
                        avlStr = avlStr + "Tu";
                    }
                    else if (list[i] == "3")
                    {
                        avlStr = avlStr + "We";
                    }
                    else if (list[i] == "4")
                    {
                        avlStr = avlStr + "Th";
                    }
                    else if (list[i] == "5")
                    {
                        avlStr = avlStr + "Fr";
                    }
                    else if (list[i] == "6")
                    {
                        avlStr = avlStr + "Sa";
                    }
                    else if (list[i] == "7")
                    {
                        avlStr = avlStr + "Su";
                    }
                }

                return(avlStr);
            }
        }
示例#5
0
        public static int DeleteOrder(int orderId)
        {
            string content = string.Empty;

            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                int requesid = (from o in db.Orders  where o.Id == orderId select o).First().RequestId ?? 0;

                var orders1 = (from w in db.Orders where w.RequestId == requesid select w);
                //it shipping billing should be deleted in case order is one becaseu there might me more orders on same request id
                if (orders1.Count() == 1)
                {
                    db.ShippingBillings.DeleteAllOnSubmit(from w in db.ShippingBillings where w.RequestId == requesid select w);
                }


                //Here updating next paying in case cash pickup
                bool    IsPriceSeted = false;
                Payment pmt;
                foreach (var ord in orders1)
                {
                    if (ord.Id != orderId)
                    {
                        if ((from w in db.Payments where w.OrderId == ord.Id select w).Count() > 0)
                        {
                            pmt = (from w in db.Payments where w.OrderId == ord.Id select w).First();
                            if (pmt.Mode.ToString() == "14" && !IsPriceSeted)
                            {
                                pmt.TrnChrg  = (from w in db.Payments where w.OrderId == orderId select w).First().TrnChrg;
                                IsPriceSeted = true;
                            }
                        }
                    }
                }
                // var ordersBig = (from w in db.Payments where w.RequestId == requesid select w);

                db.Payments.DeleteAllOnSubmit(from w in db.Payments where w.OrderId == orderId select w);
                db.OrderDetails.DeleteAllOnSubmit(from w in db.OrderDetails where w.OrderId == orderId select w);
                db.Orders.DeleteAllOnSubmit(from w in db.Orders where w.Id == orderId select w);


                db.SubmitChanges();
                CacheHelper.Clear("Holiday");
                return(1);
            }
        }
示例#6
0
        public static List <tblLocation> GetDeliveryAreaForZip(int pin)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                string pincode = string.Empty;

                //if (email != string.Empty && (from w in db.Users where w.email == email && w.UserType == "F" select w).Count() > 0)
                if ((from w in db.tblLocations where w.pincode == pin select w).Count() > 0)
                {
                    /////
                    return((from w in db.tblLocations where w.pincode == pin select w).ToList());
                }
                else
                {
                    return(new List <tblLocation>());
                }
            }
        }
示例#7
0
        public static int SaveTitle(string imageFile, string title, string folderName)
        {
            DBKOMPDataContext db = new DBKOMPDataContext();

            lock (db)
            {
                System.Diagnostics.Process.GetCurrentProcess();

                PeraImage obj = new PeraImage();

                PeraImage objUpdated = db.PeraImages.Where(p => (p.Directory == folderName && p.FileName == imageFile)).First();
                objUpdated.Detail = title;

                db.SubmitChanges();
                db.Dispose();
            }
            return(1);
        }
示例#8
0
        public static int SetUserByAdminOnBehalf(int requestId, string name, string emailid)
        {
            int    savetype = 0;
            string content  = string.Empty;

            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                int uid = 0;

                var countUser = (from w in db.Users where w.email.ToUpper() == emailid.ToUpper() select w).Count();
                if (countUser == 0)
                {
                    uid = InsertUpdateUserDetails(new User {
                        UserId = 0, FirstName = name, email = emailid, UserLoginID = emailid, password = "******" + name.Substring(0, 2)
                    });
                }
                else
                {
                    uid = (from w in db.Users where w.email.ToUpper() == emailid.ToUpper() select w).First().UserId;
                }

                var rqst = (from w in db.Requests where w.Id == requestId select w).First();
                rqst.UserId = uid;

                System.Threading.Thread.Sleep(5000);

                var shipp = (from w in db.ShippingBillings where w.RequestId == requestId select w).First();
                shipp.UserId = uid;


                var orders = (from w in db.Orders where w.RequestId == requestId select w);
                foreach (var ord in orders)
                {
                    ord.CustomerId  = uid;
                    ord.PaymentDone = 0;//pending
                }

                db.SubmitChanges();

                return(savetype);
            }
        }
示例#9
0
        public static bool AllowPayemntOnRequesteOrder(int requestId)
        {
            bool allowtopayment = true;

            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                var orders = (from w in db.Orders where w.RequestId == requestId select w).ToList();

                //if any order having start date is equal or less than current date then now allowing to payment
                foreach (var ord in orders)
                {
                    if (ord.OrderStartDate.Value <= DateTime.Today.Date)
                    {
                        allowtopayment = false;
                    }
                }
            }

            return(allowtopayment);
        }
示例#10
0
        public static string DeleteFiles(string files, string folderName)
        {
            DBKOMPDataContext db = new DBKOMPDataContext();

            string[] fileArray = files.Split(',');
            foreach (string fileName in fileArray)
            {
                //delete from direcotry
                System.IO.FileInfo fileEntries = new FileInfo(HttpContext.Current.Server.MapPath("images/" + folderName + "/" + fileName));
                fileEntries.Delete();

                //delete from database
                var objDelete = db.PeraImages.Where(p => (p.FileName == fileName)).First();

                db.PeraImages.DeleteOnSubmit(objDelete);
                db.SubmitChanges();
            }

            return(GetFilesWithCheckBox("images/" + folderName, folderName, "group1"));
        }
示例#11
0
        public static int SaveEventNPics(PeraImage peraImage)
        {
            try
            {
                DBKOMPDataContext db = new DBKOMPDataContext();

                db.PeraImages.InsertOnSubmit(peraImage);


                db.SubmitChanges();
                return(1);
                // Page.ClientScript.RegisterStartupScript(typeof(Page), "sub", "GetFiles();", true);

                // SetFolders();
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#12
0
 public static void SaveProduct(Menu obj)
 {
     using (DBKOMPDataContext db = new DBKOMPDataContext())
     {
         if (obj.Id == 0)
         {
             db.Menus.InsertOnSubmit(obj);
         }
         else
         {
             KitchenOnMyPlate.Menu objUpdated = db.Menus.Where(p => (p.Id == obj.Id)).First();
             objUpdated.Header   = obj.Header;
             objUpdated.Detail   = obj.Detail;
             objUpdated.IsActive = obj.IsActive;
         }
         db.SubmitChanges();
         db.Dispose();
         CacheHelper.Clear("Menu");
     }
 }
示例#13
0
        public static tblLocation CheckDeliveryArea(int pin)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                string pincode = string.Empty;

                //if (email != string.Empty && (from w in db.Users where w.email == email && w.UserType == "F" select w).Count() > 0)
                if ((from w in db.tblLocations where w.pincode == pin select w).Count() > 0)
                {
                    /////
                    return((from w in db.tblLocations where w.pincode == pin select w).First());
                }
                else
                {
                    return(new tblLocation {
                        pincode = 0, Location = string.Empty
                    });
                }
            }
        }
示例#14
0
        public static bool DeleteEvent(int eventId)
        {
            DBKOMPDataContext db = new DBKOMPDataContext();
            bool Deleted         = false;

            if (eventId == 0)
            {
                Deleted = false;
            }
            else
            {
                var objDelete = db.PhotoDirectories.Where(p => (p.Id == eventId)).First();
                //db.PhotoDirectories.Attach(objDelete);
                db.PhotoDirectories.DeleteOnSubmit(objDelete);
                Deleted = true;
                Directory.Delete(HttpContext.Current.Server.MapPath("images/" + objDelete.FolderName), true);
                db.SubmitChanges();
            }
            return(Deleted);
        }
示例#15
0
        public static int CheckExistingUser(string email, string mobile)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                var countUser = 0;

                //if (email != string.Empty && (from w in db.Users where w.email == email && w.UserType == "F" select w).Count() > 0)
                if (email != string.Empty && (from w in db.Users where w.email == email select w).Count() > 0)
                {
                    countUser = 111111;
                }
                else if (email != string.Empty && (from w in db.Users where w.email == email select w).Count() > 0)
                {
                    countUser = 9999999;
                }
                //else if ((from w in db.Users where w.mobile == mobile select w).Count() > 0)
                //{
                //    countUser = 8888888;
                //}
                return(countUser);
            }
        }
示例#16
0
        public static List <MenuItem> GetSubProducts()
        {
            List <MenuItem> list;

            if (!CacheHelper.Get("SubMenues", out list))
            {
                using (DBKOMPDataContext db = new DBKOMPDataContext())
                {
                    list = new List <MenuItem>();

                    var propertyType = (from w in db.MenuItems where w.IsActive == 1 orderby w.MenuId select w).ToList();

                    foreach (var item in propertyType)
                    {
                        list.Add(item);
                    }

                    CacheHelper.Add(list, "SubMenues", 2000);
                }
            }

            return(list);
        }
示例#17
0
        public static MenuItem GetNews(int newsID)
        {
            DBKOMPDataContext db = new DBKOMPDataContext();

            var dto = db.MenuItems.Where(w => w.Id == newsID).First();

            MenuItem obj = new MenuItem();

            obj.Id     = dto.Id;
            obj.Header = dto.Header;
            obj.Detail = dto.Detail;
            //obj.Date = Convert.ToDateTime(dto.Date).ToString("dd-MMM-yyyy");// +" " + Convert.ToDateTime(dto.Date).ToShortTimeString();

            obj.Picture = string.IsNullOrEmpty(dto.Picture) ? string.Empty : dto.Picture;
            //obj.NewsBy = string.IsNullOrEmpty(dto.NewsBy) ? string.Empty : dto.NewsBy;

            obj.PicDetails = string.IsNullOrEmpty(dto.PicDetails) ? string.Empty : dto.PicDetails;
            //obj.NewsURL = string.IsNullOrEmpty(dto.NewsURL) ? string.Empty : dto.NewsURL;



            return(obj);
        }
示例#18
0
        public static List <Plan> GetMealPlans()
        {
            List <Plan> list;

            if (!CacheHelper.Get("Plan", out list))
            {
                using (DBKOMPDataContext db = new DBKOMPDataContext())
                {
                    list = new List <Plan>();

                    var propertyType = (from w in db.Plans where w.IsActive == 1 orderby w.Id select w).ToList();

                    foreach (var item in propertyType)
                    {
                        list.Add(item);
                    }

                    CacheHelper.Add(list, "Plan", 2000);
                }
            }

            return(list);
        }
示例#19
0
        public static int ChangePassword(string UID, string ChngPass, string OldPassword)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                int action = 0;

                User tblus = db.Users.Single(p => p.UserLoginID == UID || p.mobile == UID);
                if (tblus.password == OldPassword)
                {
                    tblus.password = ChngPass;
                    db.SubmitChanges();
                    action = 1;


                    ChangedPasswordMail(tblus);
                }
                else
                {
                    action = 2;
                }
                return(action);
            }
        }
示例#20
0
        public static int setPaymentAsFailed(int requestId)
        {
            int    savetype = 0;
            string content  = string.Empty;

            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                int uid = 0;

                var rqst = (from w in db.Requests where w.Id == requestId select w).First();
                rqst.UserId = uid;

                var orders = (from w in db.Orders where w.RequestId == requestId select w);
                foreach (var ord in orders)
                {
                    ord.PaymentDone = 2; //Failed
                }

                db.SubmitChanges();

                return(savetype);
            }
        }
示例#21
0
        //protected void Images()
        //{
        //    System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath("images/"+Folders.SelectedItem));
        //    //to retrieve aspx files alone
        //    System.IO.FileInfo[] fileEntries = di.GetFiles("*.jpg");

        //    //string[] fileEntries = Directory.GetFiles(Server.MapPath("images/PhotaGallery"));
        //    foreach (FileInfo fileName in fileEntries)
        //    {
        //        ltrlImage.Text = ltrlImage.Text + "<div id='" + fileName.Name + "' ><a rel='group' class='aaa' title='" + fileName.Name + "' href='../Samples/" + fileName.Name + "'>" +
        //                 "<img src='images/" + Folders.Text + "/" + fileName.Name + "' width='40' height='30' /></a><input id='chk" + fileName.Name + "' type='checkbox' /></div>";

        //    }
        //}

        //protected void Folders_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    Images();
        //}

        protected void btnUpload_Click(object sender, EventArgs e)
        {
            try
            {
                DBKOMPDataContext db = new DBKOMPDataContext();

                // Get the HttpFileCollection
                HttpFileCollection hfc = Request.Files;
                for (int i = 0; i < hfc.Count; i++)
                {
                    PeraImage obj = new PeraImage();
                    obj.Directory = Folders.SelectedItem.ToString();

                    HttpPostedFile hpf = hfc[i];
                    if (hpf.ContentLength > 0)
                    {
                        hpf.SaveAs(Server.MapPath("images/" + Folders.SelectedItem) + "\\" +
                                   System.IO.Path.GetFileName(hpf.FileName));
                        Response.Write("<b>File: </b>" + hpf.FileName + "  <b>Size:</b> " +
                                       hpf.ContentLength + "  <b>Type:</b> " + hpf.ContentType + " Uploaded Successfully <br/>");
                    }

                    obj.FileName = hpf.FileName;
                    obj.Detail   = hpf.FileName.Replace(".jpg", "").Replace(".JPG", "");

                    db.PeraImages.InsertOnSubmit(obj);
                    db.SubmitChanges();
                }

                Page.ClientScript.RegisterStartupScript(typeof(Page), "sub", "GetFiles();", true);

                // SetFolders();
            }
            catch (Exception ex)
            {
            }
        }
示例#22
0
        public static List <HoliDay> GetHoliday()
        {
            List <HoliDay> list;

            if (!CacheHelper.Get("Holiday", out list))
            {
                using (DBKOMPDataContext db = new DBKOMPDataContext())
                {
                    list = new List <HoliDay>();

                    var HoliDays = (from w in db.HoliDays where w.IsActive == 1 orderby w.DeliverDate select w).ToList();

                    foreach (var item in HoliDays)
                    {
                        item.DeliverDate = Convert.ToDateTime(item.DeliverDate.Value.ToShortDateString());
                        list.Add(item);
                    }

                    CacheHelper.Add(list, "Holiday", 2000);
                }
            }

            return(list);
        }
示例#23
0
        public static int SaveShippingBilling(ShippingBilling shippingBilling)
        {
            int    savetype = 0;
            string content  = string.Empty;

            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                var countUser = (from w in db.ShippingBillings where w.RequestId == shippingBilling.RequestId select w).Count();
                if (countUser == 0)
                {
                    db.ShippingBillings.InsertOnSubmit(shippingBilling);
                    db.SubmitChanges();
                    savetype = shippingBilling.Id;
                }
                else
                {
                    savetype = (from w in db.ShippingBillings where w.RequestId == shippingBilling.RequestId select w).First().Id;
                }



                return(savetype);
            }
        }
示例#24
0
        public int SavePayementDetails(Payment objPaymentHistory)
        {
            SqlTransaction transaction = null;

            try
            {
                if (objPaymentHistory.OrderId == 0)
                {
                    //throw (new Exception("Please retrieve Customer ID"));
                    return(0);
                }


                if (objPaymentHistory.Amount == 0)
                {
                    //throw (new Exception("Please retrieve Customer ID"));
                    return(0);
                }



                con = new SqlConnection(cs);
                con.Open();
                transaction = con.BeginTransaction(IsolationLevel.ReadCommitted);

                String cbt = "select TotalPayment from [Order] where Id= '" + objPaymentHistory.OrderId + "'";
                cmd             = new SqlCommand(cbt);
                cmd.Connection  = con;
                cmd.Transaction = transaction;
                decimal amt = Convert.ToDecimal(cmd.ExecuteScalar());

                int paymenStatus = 2;
                if (objPaymentHistory.Amount >= amt)
                {
                    paymenStatus = 1; //Paid
                }

                //string invoiceno = "INV-" + GetUniqueKey(8);
                //String cb = "update [Order] set IsActive='1', PaymentDone='" + paymenStatus + "',TotalPayment = TotalPayment + " + objPaymentHistory.Amount + " where Id= '" + objPaymentHistory.OrderId + "'";
                String cb = "update [Order] set IsActive='1', PaymentDone='" + paymenStatus + "',TotalPayment = " + objPaymentHistory.Amount + " where Id= '" + objPaymentHistory.OrderId + "'";
                //string cb = "insert Into Sales(InvoiceNo,InvoiceDate,CustomerID,SubTotal,VATPercentage,VATAmount,GrandTotal,TotalPayment,PaymentDue,Remarks) VALUES ('" + invoiceno + "','" + objInvoiceData.InvoiceItems[0].InvoiceDate + "','" + objInvoiceData.InvoiceItems[0].CustomerID + "'," + objInvoiceData.InvoiceItems[0].SubTotal + "," + objInvoiceData.InvoiceItems[0].VATPercentage + "," + objInvoiceData.InvoiceItems[0].VATAmount + "," + objInvoiceData.InvoiceItems[0].GrandTotal + "," + objInvoiceData.InvoiceItems[0].TotalPayment + "," + objInvoiceData.InvoiceItems[0].PaymentDue + ",'" + objInvoiceData.InvoiceItems[0].Remarks + "')";
                cmd             = new SqlCommand(cb);
                cmd.Connection  = con;
                cmd.Transaction = transaction;

                cmd.ExecuteNonQuery();

                //cb = "update [OrderDetails] set IsActive='1'  where OrderId= '" + objPaymentHistory.OrderId + "'";
                //cmd = new SqlCommand(cb);
                //cmd.Connection = con;
                //cmd.Transaction = transaction;

                //cmd.ExecuteNonQuery();



                //if (con.State == ConnectionState.Open)
                //{
                //    con.Close();
                //}
                //con.Close();


                //Delete product
                //con = new SqlConnection(cs);
                //con.Open();
                //string invoiceno = "INV-" + GetUniqueKey(8);
                //String cb1 = "insert from ProductSold where Invoiceno= '" + objInvoiceData.InvoiceItems[0].InvoiceNo + "'";
                string cb1 = "update Payment set PaymentDate='" + objPaymentHistory.PaymentDate.Value.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLocalTime().TimeOfDay.ToString().Substring(0, 12) + "', Mode='" + objPaymentHistory.Mode + "',TransactionNo='" + objPaymentHistory.TransactionNo + "',Bank='" + objPaymentHistory.Bank + "',Branch='" + objPaymentHistory.Branch + "',Comments='" + objPaymentHistory.Comments + "', IsActive=1  where Orderid='" + objPaymentHistory.OrderId + "'";
                //string cb1 = "update Payment set Amount =Amount  + " + objPaymentHistory.Amount + ",PaymentDate='" + objPaymentHistory.PaymentDate + "', Mode='" + objPaymentHistory.Mode + "',TransactionNo='" + objPaymentHistory.TransactionNo + "',IsActive=1  where Orderid='" + objPaymentHistory.OrderId + "'";
                cmd             = new SqlCommand(cb1);
                cmd.Connection  = con;
                cmd.Transaction = transaction;
                cmd.ExecuteNonQuery();


                transaction.Commit();

                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                con.Close();
                //TODO:LATER
                //for (int i = 0; i <= objInvoiceData.CartItems.Count - 1; i++)
                //{
                //    con = new SqlConnection(cs);
                //    con.Open();
                //    string cb1 = "update stock set Quantity = Quantity - " + objInvoiceData.CartItems[i].Qty + " where ConfigID= " + objInvoiceData.CartItems[i].ConfigID + "";
                //    cmd = new SqlCommand(cb1);
                //    cmd.Connection = con;
                //    cmd.ExecuteNonQuery();
                //    con.Close();
                //}
                //for (int i = 0; i <= objInvoiceData.CartItems.Count - 1; i++)
                //{
                //    con = new SqlConnection(cs);
                //    con.Open();

                //    string cb2 = "update stock set TotalPrice = Totalprice - '" + objInvoiceData.CartItems[i].TotalAmount + "' where ConfigID= " + objInvoiceData.CartItems[i].ConfigID + "";
                //    cmd = new SqlCommand(cb2);
                //    cmd.Connection = con;
                //    cmd.ExecuteReader();
                //    con.Close();
                //}


                String cbt1 = "select RequestId from [Order] where Id= '" + objPaymentHistory.OrderId + "'";
                cmd = new SqlCommand(cbt1);
                con.Open();
                cmd.Connection = con;
                //cmd.Transaction = transaction;
                int rqst = Convert.ToInt32(cmd.ExecuteScalar());
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                con.Close();


                #region Calling yourguy api
                // var objtblUser = CommanAction.GetSession();//for yourguyonly

                using (DBKOMPDataContext db = new DBKOMPDataContext())
                {
                    var orders       = (from w in db.Orders where w.Id == objPaymentHistory.OrderId select w).First();
                    var SipBilObj    = DBAccess.GetShippingBillingByUserId(orders.CustomerId ?? 0, orders.pincode ?? 0);//for yourguyonly
                    var orderDetails = (from w in db.OrderDetails where w.OrderId == objPaymentHistory.OrderId select w);
                    //string time = orders.IsLunch == 1 ? "12:16:06Z" : "20:16:06Z";

                    string locationOfPinCode = string.Empty;
                    locationOfPinCode = (from w in db.tblLocations where w.pincode.Value == orders.pincode select w).First().Location;



                    //Yourguy  productid
                    var prodcId = "0";

                    //Your guy DateColletion
                    List <string> lstDeliveryDate = new List <string>();
                    //Your guy time
                    //string time = orders.IsLunch == 1 ? "12:16:06Z" : "20:16:06Z";
                    //Your guy time
                    string Deliverytime = orders.IsLunch == 1 ? "2015-01-01T12:16:06Z" : "2015-01-01T20:16:06Z";
                    string time         = orders.IsLunch == 1 ? "12:16:06Z" : "20:16:06Z";
                    string PickUptime   = orders.IsLunch == 1 ? "2015-01-01T10:16:06Z" : "2015-01-01T18:16:06Z";

                    foreach (var od in orderDetails)
                    {
                        prodcId = "0"; //prodcId = od.SubProductId.ToString();
                        lstDeliveryDate.Add(od.DeliverDate.Value.ToString("yyyy-MM-ddT") + time);

                        od.IsActive = 1;
                        //od.YourguyOrderId = OrderManagement.CallYourGuy(od.Id.ToString(), objPaymentHistory.OrderId.ToString(), SipBilObj, od.DeliverDate.Value.ToString("yyyy-MM-ddT") + time);
                        //"2015-07-22T12:16:06Z"
                    }

                    //Yourguy service //Yourguy service TODO: UNDO ONCE READY BY YOUR GUY
                    //orders.YourguyOrderId = OrderManagement.CallYourGuy(prodcId, orders.Id.ToString(), SipBilObj, Deliverytime, PickUptime, lstDeliveryDate, locationOfPinCode);

                    db.SubmitChanges();
                }
                #endregion



                ShippingBilling objSB = DBAccess.GetShippingBilling(rqst);

                #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)));
                content = content.Replace("$ORDERSUMMARY$", "Congratulation!! Your Order #" + objPaymentHistory.OrderId + " is confirmed!<br/>KOMP has received payment of Rs. " + objPaymentHistory.Amount + " /-");


                var sb = new StringBuilder();
                //divFinal.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
                content = content.Replace("$REQ$", "");
                content = content.Replace("$NAME$", objSB.FirstName);
                content = content.Replace("$SITE$", site);

                content = content.Replace("RobotoBlack", "Arial");
                content = content.Replace("Roboto", "Arial");
                content = content.Replace("RobotoBold", "Arial");
                content = content.Replace("images/rs3.png", "http://www.kitchenonmyplate.com/images/rs3.png");
                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("ProcessBox", "width:100%;height:auto;border:1px solid #c8c6c6;padding-bottom:10px;");
                content = content.Replace("ProcesBoxInner", "height:auto; padding:0px 25px 10px 10px;text-align: justify; text-justify: inter-word;");
                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;' ");
                content = content.Replace("price", "font-weight:700; font-size:1.2em; color: #006400;");
                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("CUSTBOX", "");
                content = content.Replace("emailH5", "font-size:14px;");
                content = content.Replace(">01<", "");
                content = content.Replace(">03<", "");

                if (!string.IsNullOrEmpty(objSB.LastName)) //Note : last name is as emailid
                {
                    MailHelper.SendMailMessage("", objSB.LastName, string.Empty, string.Empty, "KOMP : Your order #" + objPaymentHistory.OrderId + " is confirmed", content);
                    AutoServices.SendeMailToUs("Copy:KOMP : Your order #" + objPaymentHistory.OrderId + " is confirmed", content);
                }
                #endregion

                return(1);
            }
            catch (Exception exc)
            {
                transaction.Rollback();
                return(0);
                //throw exc;
            }
        }
示例#25
0
        public static int SendMsgToAgent(Message msg)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                db.Messages.InsertOnSubmit(msg);
                db.SubmitChanges();

                #region Send Mail


                string content = string.Empty;

                string filepath = "~/Email/UserMessage.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("$USER$", msg.name);
                content = content.Replace("$MESSAGE$", msg.message1);

                content = content.Replace("$EMAIL$", msg.email);
                content = content.Replace("$MOBILE$", msg.mobile);

                content = content.Replace("$SITE$", site);

                content = content.Replace("RobotoBlack", "Arial");
                content = content.Replace("Roboto", "Arial");
                content = content.Replace("RobotoBold", "Arial");
                content = content.Replace("images/rs3.png", "http://www.kitchenonmyplate.com/images/rs3.png");
                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("ProcessBox", "width:100%;height:auto;border:1px solid #c8c6c6;padding-bottom:10px;");
                content = content.Replace("ProcesBoxInner", "height:auto; padding:0px 25px 10px 10px;text-align: justify; text-justify: inter-word;");
                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;' ");
                content = content.Replace("price", "font-weight:700; font-size:1.2em; color: #006400;");
                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("CUSTBOX", "");
                content = content.Replace("emailH5", "font-size:14px;");

                content = content.Replace(">01<", "");
                content = content.Replace(">03<", "");
                //MailHelper.SendMailMessage("", objtblUser.email, string.Empty, string.Empty, "Thanks for Posting", content);
                //MailHelper.SendMailMessage("", "*****@*****.**", string.Empty, string.Empty, "User message", content);
                string ownerEmailId1 = ConfigurationManager.AppSettings["OwnerEmailID1"].ToString();
                MailHelper.SendMailMessage("", ownerEmailId1, string.Empty, string.Empty, "Visitor's message", content);
                string ownerEmailId2 = ConfigurationManager.AppSettings["OwnerEmailID2"].ToString();
                MailHelper.SendMailMessage("", ownerEmailId2, string.Empty, string.Empty, "Visitor's message", content);


                #endregion

                return(1);
            }
        }
示例#26
0
        //public static int SaveOrder(OrderList orders)
        //{
        //    //Now taking it from session. instead of perameter.
        //    if (HttpContext.Current.Session["OrderList"] != null)
        //    {
        //        orders = (OrderList)HttpContext.Current.Session["OrderList"];
        //    }

        //    using (DBKOMPDataContext db = new DBKOMPDataContext())
        //    {
        //        int customerId = 0;
        //        if (HttpContext.Current.Session["USER"] != null)
        //        {
        //            customerId = ((User)HttpContext.Current.Session["USER"]).UserId;
        //        }



        //        Request objRequest = new Request();
        //        objRequest.CreatedDate = DateTime.Now;
        //        objRequest.UserId = customerId;
        //        objRequest.CreatedBy = customerId;

        //        //create a request id
        //        db.Requests.InsertOnSubmit(objRequest);
        //        db.SubmitChanges();

        //        foreach(var order in orders.orders)
        //        {
        //            order.Order.RequestId = objRequest.Id;
        //            order.Order.CustomerId = customerId;
        //            order.Order.OrderDate = DateTime.Now;
        //            db.Orders.InsertOnSubmit(order.Order);
        //            db.SubmitChanges();

        //            order.payment.OrderId = order.Order.Id;
        //            db.Payments.InsertOnSubmit(order.payment);

        //            foreach (var apt in order.OrderDetailList)
        //            {
        //                apt.OrderId = order.Order.Id;
        //            }

        //            db.OrderDetails.InsertAllOnSubmit(order.OrderDetailList);
        //        }

        //        db.SubmitChanges();

        //        //#region Send Mail
        //        //if (HttpContext.Current.Session["USER"] != null)
        //        //{
        //        //    var objtblUser = (User)HttpContext.Current.Session["USER"];

        //        //    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);
        //        //    content = content.Replace("$NAME$", objtblUser.FirstName + " " + objtblUser.LastName);
        //        //    content = content.Replace("$SITE$", site);

        //        //    if (!string.IsNullOrEmpty(objtblUser.email))
        //        //    {
        //        //        MailHelper.SendMailMessage("", objtblUser.email, string.Empty, string.Empty, "Thanks for Posting", content);
        //        //       // AutoServices.SendeMailToUs("Copy:Thanks for Posting", content);

        //        //    }
        //        //}
        //        //#endregion

        //       // HttpContext.Current.Session["OrderList"] = orders;

        //        return objRequest.Id;// orderDTO.Order.Id;
        //    }
        //}

        public static int SavePayemt(int requestId, int paymentStatus, int paymentMode, string cardNum, string trnNo, string NameOnCard)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                var objtblUser = CommanAction.GetSession();//for yourguyonly
                var orders     = (from w in db.Orders where w.RequestId == requestId select w).ToList();

                var SipBilObj = new ShippingBilling();

                string locationOfPinCode = string.Empty;
                if (orders.Count > 0)
                {
                    locationOfPinCode = (from w in db.tblLocations where w.pincode.Value == orders[0].pincode select w).First().Location;
                }

                //Variable is using to add 25 rs only one time
                bool IsCashPickup25Added = false;
                foreach (var ord in orders)
                {
                    if (string.IsNullOrEmpty(SipBilObj.Pincode))
                    {
                        SipBilObj = DBAccess.GetShippingBillingByUserId(objtblUser.UserId, ord.pincode ?? 0);//for yourguyonly
                    }

                    if (requestId > 0)
                    {
                        var payment = (from w in db.Payments where w.OrderId == ord.Id select w).First();
                        //paymentObj.Amount = 200;
                        payment.CardNumber    = cardNum;
                        payment.Mode          = paymentMode; //NET BANKING-1, credit card-2, debit card - 3, cash card - 4, mobile payment-5
                        payment.NameOnCard    = NameOnCard;
                        payment.TransactionNo = trnNo;
                        payment.IsActive      = (paymentStatus == 1) ? 1 : 0;
                        payment.PaymentDate   = DateTime.Now;


                        //Settign for offline casehpickup
                        if (paymentMode == 14 && !IsCashPickup25Added)
                        {
                            var config = DBAccess.GetConfig();
                            //order.payment.TrnChrg = Convert.ToDecimal(Caspikup + CaspikupPer * (order.payment.Amount + order.payment.DeliveryChrg) / 100);
                            payment.TrnChrg = Convert.ToDecimal(config.CashPickUpPercent * (payment.Amount + payment.DeliveryChrg) / 100) + config.CashPickUp ?? 0;

                            payment.TrnChrg = Convert.ToDecimal(String.Format("{0:.00}", payment.TrnChrg));

                            //payment.TrnChrg = Convert.ToInt32(payment.TrnChrg + config.CashPickUp ?? 0);
                            IsCashPickup25Added = true;
                        }


                        ord.PaymentDone = paymentStatus;    //SUCCESS -1 , failure - 0 , invalid =3, abort = 4 ---  paymentMode != 5 ? 1 : 0; //5 means offline
                        ord.IsActive    = (paymentStatus == 1)?1:0;



                        if (paymentStatus == 1 && (paymentMode != 11 && paymentMode != 12 && paymentMode != 13 && paymentMode != 14))     //Not offline and not cash pickup
                        {
                            var orderDetails = (from w in db.OrderDetails where w.OrderId == ord.Id select w);

                            //Yourguy  productid
                            var prodcId = "0";
                            //Your guy DateColletion
                            List <string> lstDeliveryDate = new List <string>();
                            //Your guy time
                            string Deliverytime = ord.IsLunch == 1 ? "2015-01-01T12:15:02Z" : "2015-01-01T20:15:02Z";
                            string time         = ord.IsLunch == 1 ? "12:16:06Z" : "20:16:06Z";
                            string PickUptime   = ord.IsLunch == 1 ? "2015-01-01T10:16:06Z" : "2015-01-01T18:16:06Z";


                            foreach (var od in orderDetails)
                            {
                                prodcId = "0";    // od.SubProductId.ToString();
                                lstDeliveryDate.Add(od.DeliverDate.Value.ToString("yyyy-MM-ddT") + time);

                                od.IsActive = 1;
                                //od.YourguyOrderId = YourGuy(od.Id.ToString(), ord.Id.ToString(), SipBilObj, od.DeliverDate.Value.ToString("yyyy-MM-ddT") + time);
                                //"2015-07-22T12:16:06Z"
                            }

                            //Yourguy service TODO: UNDO ONCE READY BY YOUR GUY
                            //ord.YourguyOrderId = CallYourGuy(prodcId, ord.Id.ToString(), SipBilObj, Deliverytime, PickUptime, lstDeliveryDate, locationOfPinCode);
                        }



                        db.SubmitChanges();
                    }
                    //else
                    //{
                    //    //ord.PaymentDone = 3; //Payment Failed
                    //    //ord.IsActive = 1;
                    //    //db.SubmitChanges();
                    //}
                }



                return(1);
            }
        }
示例#27
0
        public static int SaveOrder(string method)
        {
            OrderList orders = new OrderList();

            //Now taking it from session. instead of perameter.
            if (HttpContext.Current.Session["OrderList"] != null)
            {
                orders = (OrderList)HttpContext.Current.Session["OrderList"];
            }
            else
            {
                //It create the orders from the cookies
                if (OrderManagement.GetOrderListSession().orders.Count == 0)
                {
                    return(-1);
                }
            }

            //Below condition : already ordered


            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                int customerId = 0;
                //if (CommanAction.GetSession() != null)
                //{
                customerId = CommanAction.GetSession().UserId;
                //}

                //Delete if already in cart
                if (orders.orders.Count > 0 && orders.orders[0].Order.RequestId > 0)
                {
                    foreach (var order in orders.orders)
                    {
                        if (orders.orders.Count > 0 && orders.orders[0].Order.RequestId > 0)
                        {
                            db.OrderDetails.DeleteAllOnSubmit((from w in db.OrderDetails where w.OrderId == order.Order.Id select w));
                            db.Payments.DeleteAllOnSubmit((from w in db.Payments where w.OrderId == order.Order.Id select w));
                        }
                    }
                    db.Requests.DeleteAllOnSubmit((from w in db.Requests where w.Id == orders.orders[0].Order.RequestId select w));
                    db.Orders.DeleteAllOnSubmit((from w in db.Orders where w.RequestId == orders.orders[0].Order.RequestId select w));
                    db.SubmitChanges();
                }


                decimal tranCharge       = 0;
                decimal tranChargeConfig = (from w in db.Configs select w).First().TrnChrg ?? 0;

                var     config      = (from w in db.Configs select w).First();
                decimal Caspikup    = config.CashPickUp ?? 0;
                decimal CaspikupPer = config.CashPickUpPercent ?? 0;



                //////////////////REQUEST START
                Request objRequest = new Request();
                objRequest.CreatedDate = DateTime.Now;
                objRequest.UserId      = customerId;
                objRequest.CreatedBy   = customerId;

                if (method == "14") //Cash pikup delivery charges by yourguy
                {
                    objRequest.YourGuyChkPickUP = Convert.ToInt32(Caspikup);
                }
                //create a request id
                db.Requests.InsertOnSubmit(objRequest);
                db.SubmitChanges();
                //////////////////REQUEST END


                TimeZoneInfo INDIAN_ZONE = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
                DateTime     indianTime  = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);

                foreach (var order in orders.orders)
                {
                    Caspikup = 0;// resetting 0 becuasue unable to divide charges in n order so making o, actial charges are in Request table
                    order.Order.RequestId      = objRequest.Id;
                    order.Order.CustomerId     = customerId;
                    order.Order.OrderDate      = indianTime;// DateTime.Now;
                    order.Order.OrderStartDate = order.OrderDetailList[0].DeliverDate;

                    tranCharge = ((order.payment.Amount + order.payment.DeliveryChrg) * tranChargeConfig / 100) ?? 0;


                    order.Order.TotalPayment = (method == "11" || method == "12" || method == "13")?0:(order.payment.Amount + tranCharge + order.payment.DeliveryChrg);

                    if (method == "14")//Cas pikup
                    {
                        order.Order.TotalPayment = (method == "11" || method == "12" || method == "13") ? 0 : (order.payment.Amount + Caspikup + order.payment.DeliveryChrg);
                    }


                    db.Orders.InsertOnSubmit(order.Order);
                    db.SubmitChanges();



                    if (method == "14") //Cash pikup delivery
                    {
                        order.payment.TrnChrg = Convert.ToDecimal(Caspikup + CaspikupPer * (order.payment.Amount + order.payment.DeliveryChrg) / 100);
                        //Round off for cash pickup
                    }
                    else if (method == "11" || method == "12" || method == "13")
                    {
                        order.payment.TrnChrg = 0; //Add 0 if offline else calculate trans charge
                    }
                    else
                    {
                        order.payment.TrnChrg = tranCharge; //for online calculate trans charge
                    }


                    order.payment.OrderId = order.Order.Id;
                    db.Payments.InsertOnSubmit(order.payment);

                    foreach (var apt in order.OrderDetailList)
                    {
                        apt.OrderId = order.Order.Id;
                    }

                    db.OrderDetails.InsertAllOnSubmit(order.OrderDetailList);
                }

                db.SubmitChanges();

                //#region Send Mail
                //if (HttpContext.Current.Session["USER"] != null)
                //{
                //    var objtblUser = (User)HttpContext.Current.Session["USER"];

                //    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);
                //    content = content.Replace("$NAME$", objtblUser.FirstName + " " + objtblUser.LastName);
                //    content = content.Replace("$SITE$", site);

                //    if (!string.IsNullOrEmpty(objtblUser.email))
                //    {
                //        MailHelper.SendMailMessage("", objtblUser.email, string.Empty, string.Empty, "Thanks for Posting", content);
                //       // AutoServices.SendeMailToUs("Copy:Thanks for Posting", content);

                //    }
                //}
                //#endregion

                // HttpContext.Current.Session["OrderList"] = orders;

                HttpContext.Current.Session["OrderList"] = orders;

                CreateCookieOrderList();
                return(objRequest.Id);// orderDTO.Order.Id;
            }
        }
示例#28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["lang"] != null)
            {
                SetCulture(Session["lang"].ToString());
            }
            else
            {
                SetCulture("en-US");
            }


            //Filling event dropdown
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                // divCityDropDown = "<div style='width:auto;height:auto'>";
                var events = (from w in db.PhotoDirectories where w.Type == "E" orderby w.Id descending select w).ToList();
                int length = events.Count();
                for (int i = 0; i < length; i++)
                {
                    if (i == 0)
                    {
                        evetnName = events[i].FolderName;
                    }

                    if (i == length - 1)
                    {
                        SpnLatestEvent.InnerHtml = events[i].AlbumName;
                    }

                    //string cities = "SetDivisionPage(" + zones[i].Id + ",'aDID" + zones[i].Id + "')";
                    //divCities.InnerHtml = divCities.InnerHtml + "<a  id='aDRP" + events[i].Id + "' href='Event-" + events[i].AlbumName.Replace(" ", "_") + "'  >" + events[i].AlbumName + "</a></br>";
                    divCities.InnerHtml = divCities.InnerHtml + "<a  id='aDRP" + events[i].Id + "' href='Events.aspx?id=" + events[i].Id + "'  >" + events[i].AlbumName + "</a></br>";
                    divCities.InnerHtml = (i < (length - 1)) ? divCities.InnerHtml + "<hr style='border-top:1px;width: 75%'/>" : divCities.InnerHtml + "";
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                using (DBKOMPDataContext db = new DBKOMPDataContext())
                {
                    // divCityDropDown = "<div style='width:auto;height:auto'>";
                    evetnName = (from w in db.PhotoDirectories where w.Id == Convert.ToInt32(Request.QueryString["id"]) orderby w.Id descending select w).First().FolderName;
                }
            }

            if (Page.RouteData.Values["e"] != null)
            {
                string actualName = string.Empty;
                evetnName = Page.RouteData.Values["e"] as string;
                evetnName = evetnName == null ? "" : evetnName.Replace("_", "");

                if (string.IsNullOrEmpty(evetnName))
                {
                    Page.Title           = "Swami Samarth Seva-Events";
                    Page.MetaDescription = "Swami Samarth Seva-Events";
                    Page.MetaKeywords    = "Swami Samarth Seva-Events";
                }
                else
                {
                    actualName           = Page.RouteData.Values["e"].ToString().Replace("_", " ");
                    Page.Title           = "Event-" + actualName;
                    Page.MetaDescription = "Event " + actualName;
                    Page.MetaKeywords    = "Swami Samarth Seva-Events";
                }
            }
        }
示例#29
0
        public static string GetAvailabilityOfMainProduct(int id)
        {
            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                var avlStr = string.Empty;
                var aval   = (from w in db.MenuItems where w.MenuId == id select w);
                //
                string strav = string.Empty;
                foreach (var item in aval)
                {
                    strav = strav + item.AvailableDay;
                }

                //var list = aval.AvailableDay.Split(',');
                //foreach(var item in aval)
                //{

                string containsAll = string.Empty;
                if (strav.Contains("1"))
                {
                    if (avlStr != string.Empty)
                    {
                        avlStr = avlStr + " | ";
                    }
                    avlStr      = avlStr + "MON";
                    containsAll = containsAll + "1";
                }

                if (strav.Contains("2"))
                {
                    if (avlStr != string.Empty)
                    {
                        avlStr = avlStr + " | ";
                    }
                    avlStr      = avlStr + "TUE";
                    containsAll = containsAll + "2";
                }

                if (strav.Contains("3"))
                {
                    if (avlStr != string.Empty)
                    {
                        avlStr = avlStr + " | ";
                    }
                    avlStr      = avlStr + "WED";
                    containsAll = containsAll + "3";
                }

                if (strav.Contains("4"))
                {
                    if (avlStr != string.Empty)
                    {
                        avlStr = avlStr + " | ";
                    }
                    avlStr      = avlStr + "THU";
                    containsAll = containsAll + "4";
                }

                if (strav.Contains("5"))
                {
                    if (avlStr != string.Empty)
                    {
                        avlStr = avlStr + " | ";
                    }
                    avlStr      = avlStr + "FRI";
                    containsAll = containsAll + "5";
                }

                if (strav.Contains("6"))
                {
                    if (avlStr != string.Empty)
                    {
                        avlStr = avlStr + " | ";
                    }
                    avlStr      = avlStr + "SAT";
                    containsAll = containsAll + "6";
                }

                if (strav.Contains("7"))
                {
                    if (avlStr != string.Empty)
                    {
                        avlStr = avlStr + " | ";
                    }
                    avlStr      = avlStr + "SUN";
                    containsAll = containsAll + "7";
                }

                //}

                if (containsAll.Contains("12"))
                {
                    avlStr = "MON - TUE";
                }

                if (containsAll.Contains("123"))
                {
                    avlStr = "MON - WED";
                }

                if (containsAll.Contains("1234"))
                {
                    avlStr = "MON - THU";
                }

                if (containsAll.Contains("12345"))
                {
                    avlStr = "MON - FRI";
                }
                if (containsAll.Contains("123456"))
                {
                    avlStr = "MON - SAT";
                }

                if (containsAll.Contains("1234567"))
                {
                    avlStr = "MON - SUN";
                }

                return(avlStr);
            }
        }
示例#30
0
        public static int InsertUpdateUserDetails(User objtblUser)
        {
            int    savetype = 0;
            string content  = string.Empty;

            using (DBKOMPDataContext db = new DBKOMPDataContext())
            {
                var countUser = (from w in db.Users where (objtblUser.UserLoginID != string.Empty && w.email == objtblUser.UserLoginID) select w).Count();
                if (countUser == 0)
                {
                    objtblUser.password = objtblUser.FirstName.Substring(0, 2) + "9876";

                    db.Users.InsertOnSubmit(objtblUser);

                    string filepath = "~/Email/NewRegistration.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();
                    string uid = string.IsNullOrEmpty(objtblUser.email) ? objtblUser.UserLoginID : objtblUser.email;
                    content = content.Replace("$UID$", uid);
                    content = content.Replace("$PWD$", objtblUser.password);
                    content = content.Replace("$NAME$", objtblUser.FirstName);
                    content = content.Replace("$SITE$", site);

                    string encryptemailid = EncryptDecrypt.EncryptString(objtblUser.email, "kota@1234");
                    encryptemailid = encryptemailid.Replace("+", "_");
                    string hreflnk = "http://www." + site + "/Register.aspx?rid=" + encryptemailid;
                    content = content.Replace("$PROFILE$", hreflnk);

                    content = content.Replace("RobotoBlack", "Arial");
                    content = content.Replace("Roboto", "Arial");
                    content = content.Replace("RobotoBold", "Arial");
                    content = content.Replace("images/rs3.png", "http://www.kitchenonmyplate.com/images/rs3.png");
                    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("ProcessBox", "width:100%;height:auto;border:1px solid #c8c6c6;padding-bottom:10px;");
                    content = content.Replace("ProcesBoxInner", "height:auto; padding:0px 25px 10px 10px;text-align: justify; text-justify: inter-word;");
                    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;' ");
                    content = content.Replace("price", "font-weight:700; font-size:1.2em; color: #006400;");
                    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("CUSTBOX", "");
                    content = content.Replace("emailH5", "font-size:14px;");

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


                    if (!string.IsNullOrEmpty(objtblUser.email))
                    {
                        MailHelper.SendMailMessage("", objtblUser.email, string.Empty, string.Empty, "Welcome to " + site, content);

                        //  AutoServices.SendeMailToUs("Copy:Welcome to " + site, content);
                    }
                    MailHelper.SendMailMessage("", ConfigurationManager.AppSettings["OwnerEmailID1"].ToString(), string.Empty, string.Empty, "Copy : Welcome to " + site, "Below Mail Details for new user<br/><br/>" + content);
                    //MailHelper.SendMailMessage("", ConfigurationManager.AppSettings["OwnerEmailID2"].ToString(), string.Empty, string.Empty, "Copy : Welcome to " + site, "Below Mail Details for new user<br/><br/>" + content);
                    //string ownerEmailId = ConfigurationManager.AppSettings["OwnerEmailID"].ToString();
                    //MailHelper.SendMailMessage("", ownerEmailId, string.Empty, string.Empty, "New User is Created", "Below Mail Details for new user<br/><br/>" + content);
                }
                else
                {
                    User tblus = db.Users.Single(p => (objtblUser.UserLoginID != string.Empty && p.UserLoginID == objtblUser.UserLoginID) || p.mobile == objtblUser.mobile);

                    if (objtblUser.email == objtblUser.mobile && objtblUser.mobile != tblus.mobile)
                    {
                        tblus.email       = objtblUser.mobile;
                        tblus.UserLoginID = objtblUser.mobile;
                    }

                    tblus.email        = objtblUser.email;
                    tblus.UserType     = objtblUser.UserType;
                    tblus.FirstName    = objtblUser.FirstName;
                    tblus.LastName     = objtblUser.LastName;
                    tblus.mobile       = objtblUser.mobile;
                    tblus.picture      = objtblUser.picture;
                    tblus.LocationId   = objtblUser.LocationId;
                    tblus.WorkingSince = objtblUser.WorkingSince;

                    tblus.STDCode     = objtblUser.STDCode;
                    tblus.LandLine    = objtblUser.LandLine;
                    tblus.LandLine1   = objtblUser.LandLine1;
                    tblus.LandLine2   = objtblUser.LandLine2;
                    tblus.WebsiteLink = objtblUser.WebsiteLink;
                    tblus.SocialLink  = objtblUser.SocialLink;

                    tblus.Address     = objtblUser.Address;
                    tblus.AboutUs     = objtblUser.AboutUs;
                    tblus.CompanyName = objtblUser.CompanyName;
                    tblus.CompanyLogo = objtblUser.CompanyLogo;
                }
                db.SubmitChanges();
                savetype = objtblUser.UserId;

                return(savetype);
            }
        }