예제 #1
0
        public ActionResult AddProfileModificationRequest(tbl_Profile request, int?RequestId = null)
        {
            var getProfile       = new ProfileDataAccess().GetProfileById(request.ID);
            var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault());

            request.AuthorizationStatus   = getProfile.AuthorizationStatus;
            request.AuthorizationComments = getProfile.AuthorizationComments;

            var existingJson = getProfile == null ? null : CustomHelper.GetJson(getProfile);
            var updatedJson  = CustomHelper.GetJson(request);

            var row = new tbl_System_Requests
            {
                ID = RequestId.GetValueOrDefault(),
                AuthorizationStatus   = "P",
                CreatorID             = StateHelper.UserId,
                IsActive              = true,
                ExistingData          = existingJson,
                UpdatedData           = updatedJson,
                RequestType           = Constants.RequestTypes.ProfileModification,
                AuthorizationComments = getSystemRequest?.AuthorizationComments,
                AuthorizerID          = getSystemRequest?.AuthorizerID
            };

            var success = (!RequestId.HasValue || RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row);

            return(Json(new { IsSuccess = success }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult AddUpdateProfile(tbl_Profile request)
        {
            var profile = new tbl_Profile
            {
                ID                  = request.ID,
                Title               = request.Title,
                IsActive            = request.IsActive,
                AuthorizationStatus = "P"
            };

            var success = request.ID > 0 ? new ProfileDataAccess().UpdateProfile(profile) : new ProfileDataAccess().AddProfile(profile);

            return(Json(new { IsSuccess = success }, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        // GET: Profile [Use to add profile]
        public ActionResult Index(int?Id)
        {
            var viewModel = new tbl_Profile();

            if (Id.HasValue)
            {
                viewModel = new ProfileDataAccess().GetProfileById(Id.GetValueOrDefault());
                if (viewModel.AuthorizationStatus != "R")
                {
                    return(RedirectToAction("DashboardView", "Base"));
                }
            }

            return(View(viewModel));
        }
예제 #4
0
        public ActionResult AuthorizeNewProfileRequest(tbl_Profile request)
        {
            var profile = new ProfileDataAccess().GetProfileById(request.ID);
            var log     = new UserLogDataAccess().GetUserLogByEntityId(request.ID, "tbl_Profile");

            if (log.FirstOrDefault()?.ActionUserStamp == StateHelper.UserId)
            {
                return(Json(new { IsSuccess = false, ErrorMessage = CustomMessages.SameCreatorAndsAuthorizer }, JsonRequestBehavior.AllowGet));
            }

            profile.AuthorizationStatus   = request.AuthorizationStatus;
            profile.AuthorizationComments = request.AuthorizationComments;
            var success = new ProfileDataAccess().UpdateProfile(profile);

            return(Json(new { IsSuccess = success, ErrorMessage = (!success) ? CustomMessages.GenericErrorMessage : CustomMessages.AuthorizedSucessfully, Response = success }, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
 public bool AddProfile(tbl_Profile row)
 {
     try
     {
         using (var db = new SoneriCISEntities())
         {
             db.tbl_Profile.Add(row);
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
예제 #6
0
        public JsonResult AddNewAdmin(Profile newAdmin)
        {
            tbl_Profile prf = new tbl_Profile();

            prf.F_Name             = newAdmin.F_Name;
            prf.L_Name             = newAdmin.L_Name;
            prf.Address            = newAdmin.Address;
            prf.Email              = newAdmin.Email;
            prf.PhoneNo            = newAdmin.PhoneNo;
            prf.DOB                = newAdmin.DOB;
            prf.City               = newAdmin.City;
            prf.State              = newAdmin.State;
            prf.Status             = true;
            prf.EmailNotifications = newAdmin.EmailNotifications;
            prf.UserType           = newAdmin.UserType;
            prf.Password           = newAdmin.Password;
            prf.AddedBy            = Request.Cookies["AddedBy"].Value;
            context.tbl_Profile.Add(prf);
            context.SaveChanges();
            return(Json("Added."));
        }
예제 #7
0
        public JsonResult AddNewMember(Profile newMember)
        {
            int         currentUserTypeLoggedin = Convert.ToInt32(Request.Cookies["UserType"].Value);
            tbl_Profile prf = new tbl_Profile();

            prf.F_Name             = newMember.F_Name;
            prf.L_Name             = newMember.L_Name;
            prf.Address            = newMember.Address;
            prf.Email              = newMember.Email;
            prf.PhoneNo            = newMember.PhoneNo;
            prf.DOB                = newMember.DOB;
            prf.City               = newMember.City;
            prf.State              = newMember.State;
            prf.Status             = true;
            prf.EmailNotifications = newMember.EmailNotifications;
            prf.UserType           = newMember.UserType;
            //prf.Password = newMember.Password;
            prf.AddedBy        = Request.Cookies["AddedBy"].Value;
            prf.Walk_In_Member = true;
            //if (currentUserTypeLoggedin == 2)
            //{
            //    prf.NewUsrBySuperApprv = false;
            //}
            //else
            //{
            prf.NewUsrBySuperApprv = true;
            //}
            prf.DelUsrBySuperApprv   = false;
            prf.Reference_Of_Walk_In = newMember.Reference_Of_Walk_In;
            context.tbl_Profile.Add(prf);
            context.SaveChanges();
            int userId     = prf.ID;
            var jsonResult = new
            {
                userId = userId,
                currentUserTypeLoggedin = currentUserTypeLoggedin
            };

            return(Json(jsonResult));
        }
예제 #8
0
 public bool UpdateProfile(tbl_Profile row)
 {
     try
     {
         using (var db = new SoneriCISEntities())
         {
             tbl_Profile u = new DAL.tbl_Profile();
             u                       = db.tbl_Profile.Where(a => a.ID == row.ID).FirstOrDefault();
             u.IsActive              = row.IsActive;
             u.Title                 = row.Title;
             u.AuthorizationStatus   = row.AuthorizationStatus;
             u.AuthorizationComments = row.AuthorizationComments;
             u.IsActive              = row.IsActive;
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
예제 #9
0
        public JsonResult CreateOrder(MenusBillingSection model)
        {
            var    gstPercentFromConfig = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["FoodGstPercent"]);
            double?amtWithoutTax        = 0;
            double?gst        = 0;
            var    date       = DateTime.Today;
            string DateFormat = date.ToString(@"MM\/dd\/yyyy");

            TimeSpan time         = DateTime.Now.TimeOfDay;
            var      tableDetails = context.tbl_TablesForBooking.SingleOrDefault(v => v.ID == model.TableID && v.Table_Status == "closed");

            if (tableDetails != null)
            {
                if (model.UserID == 0 && model.Customer_Name != "" && model.Customer_Name != null)
                {
                    tbl_Profile prf = new tbl_Profile();
                    prf.F_Name         = model.Customer_Name;
                    prf.PhoneNo        = model.Phone;
                    prf.Walk_In_Member = true;

                    prf.Status               = true;
                    prf.UserType             = 3;
                    prf.AddedBy              = Request.Cookies["AddedBy"].Value;
                    prf.NewUsrBySuperApprv   = true;
                    prf.DelUsrBySuperApprv   = false;
                    prf.Reference_Of_Walk_In = "0";
                    prf.EmailNotifications   = true;
                    context.tbl_Profile.Add(prf);
                    context.SaveChanges();
                    model.UserID = prf.ID;
                }
                var billDet = context.tbl_MenusBillingSection.ToList().LastOrDefault();

                foreach (var f in model.MenusBillingDetailsWithBillNo)
                {
                    tbl_MenusBillingDetailsWithBillNo menusdetails = new tbl_MenusBillingDetailsWithBillNo();
                    menusdetails.BillNo   = (billDet != null) ? billDet.Bill_Number + 1 : 1;
                    menusdetails.FoodName = f.FoodName;
                    menusdetails.Price    = f.Price;
                    menusdetails.Quantity = f.Quantity;

                    menusdetails.OldQuantity = f.Quantity;

                    context.tbl_MenusBillingDetailsWithBillNo.Add(menusdetails);
                    context.SaveChanges();

                    amtWithoutTax += (f.Price * f.Quantity);

                    var data = context.tbl_Menu.SingleOrDefault(a => a.ID == f.ItemNameID);    // && a.Price==model.Price);
                    if (data != null)
                    {
                        if (data.InventoryID != 0)
                        {
                            tbl_InventoryUsage usage = new tbl_InventoryUsage();
                            usage.InventoryID           = data.InventoryID;
                            usage.Used_Qty              = f.Quantity;
                            usage.Description           = "(Bill No. : " + ((billDet != null) ? (billDet.Bill_Number + 1) : 1) + ") Sold to customer on " + DateFormat;
                            usage.Used_Date             = DateFormat;
                            usage.BillNo                = (billDet != null) ? billDet.Bill_Number + 1 : 1;
                            usage.MenusBillingDetailsID = menusdetails.ID;
                            usage.GST_NonGST_Bill       = "GST";
                            context.tbl_InventoryUsage.Add(usage);
                            context.SaveChanges();
                        }
                    }

                    var consumeItem = context.tbl_ConsumableItems.Where(s => s.MenuItem_ID == f.ItemNameID).ToList();
                    if (consumeItem.Count > 0)
                    {
                        foreach (var m in consumeItem)
                        {
                            string             tempUsedQty = Convert.ToString(f.Quantity * m.Quantity);
                            tbl_InventoryUsage usage       = new tbl_InventoryUsage();
                            usage.InventoryID           = m.Inventory_ID;
                            usage.Used_Qty              = Convert.ToDouble(tempUsedQty); //Math.Round((double)(f.Quantity * m.Quantity), 2);
                            usage.Description           = "Bill No. : " + ((billDet != null) ? (billDet.Bill_Number + 1) : 1) + " | " + f.FoodName;
                            usage.Used_Date             = DateFormat;
                            usage.BillNo                = (billDet != null) ? billDet.Bill_Number + 1 : 1;
                            usage.MenusBillingDetailsID = menusdetails.ID;
                            usage.GST_NonGST_Bill       = "GST";
                            context.tbl_InventoryUsage.Add(usage);
                            context.SaveChanges();
                        }
                    }
                }
                //gst = amtWithoutTax * (2.5 / 100);
                //gst = (gst * 2);
                gst           = amtWithoutTax * ((double)gstPercentFromConfig / (double)100);
                gst           = Math.Round((double)gst, 2);
                amtWithoutTax = Math.Round((double)amtWithoutTax, 2);

                tbl_MenusBillingSection menus = new tbl_MenusBillingSection();
                menus.Bill_Number     = (billDet != null) ? billDet.Bill_Number + 1 : 1;
                menus.Customer_Name   = model.Customer_Name;
                menus.Phone           = model.Phone;
                menus.Price           = Math.Round((double)(gst + amtWithoutTax), 2);
                menus.UserID          = model.UserID;
                menus.GST             = gst;
                menus.PriceWithoutTax = amtWithoutTax;
                menus.TableID         = model.TableID;
                menus.OrderTakenBy    = model.OrderTakenBy;
                menus.Table_Status    = "opened";
                menus.menubillno      = GetBillNO();
                menus.PaymentDate     = DateFormat;
                menus.Order_Time      = time;
                context.tbl_MenusBillingSection.Add(menus);
                context.SaveChanges();

                var tblOrder = context.tbl_TablesForBooking.SingleOrDefault(d => d.ID == model.TableID);
                if (tblOrder != null)
                {
                    tblOrder.Table_Status         = "opened";
                    context.Entry(tblOrder).State = EntityState.Modified;
                    context.SaveChanges();
                }
                return(Json("Saved"));
            }
            return(Json("Already opened"));
        }
예제 #10
0
        public JsonResult addStayOfCustomer(string checkin, string checkout, string UserID, string membershipID, string memberName, string phno, int noOfNights, List <RoomBooking_Details> roomInfo, double?advancedPayment, int gstPercent)
        {
            double?amt = 0;

            if (UserID == "0")
            {
                tbl_Profile prf = new tbl_Profile();
                prf.F_Name         = memberName;
                prf.PhoneNo        = phno;
                prf.Walk_In_Member = true;

                prf.Status               = true;
                prf.UserType             = 3;
                prf.AddedBy              = Request.Cookies["AddedBy"].Value;
                prf.NewUsrBySuperApprv   = true;
                prf.DelUsrBySuperApprv   = false;
                prf.Reference_Of_Walk_In = "0";
                prf.EmailNotifications   = true;
                context.tbl_Profile.Add(prf);
                context.SaveChanges();
                UserID = prf.ID.ToString();
            }
            foreach (var i in roomInfo)
            {
                amt += i.TAmtPerRoom;
            }
            tbl_RoomBooking usrStay = new tbl_RoomBooking();

            if (UserID != "0")
            {
                usrStay.UserID = Convert.ToInt32(UserID);
            }
            else
            {
                usrStay.UserID = null;
            }

            if (membershipID != "0" && membershipID != null)
            {
                usrStay.MemberID = Convert.ToInt32(membershipID);
            }
            else
            {
                usrStay.MemberID = null;
            }

            usrStay.Check_In  = checkin;
            usrStay.Check_Out = checkout;

            usrStay.NoOfNightStays = noOfNights;
            usrStay.Roombillno     = GetBillNO();
            usrStay.Amount         = Math.Round((double)amt, 2);

            if (advancedPayment != null)
            {
                usrStay.AdvancedPayment = advancedPayment;
            }
            else
            {
                usrStay.AdvancedPayment = 0;
            }

            usrStay.GstPercent = gstPercent;
            context.tbl_RoomBooking.Add(usrStay);
            context.SaveChanges();

            foreach (var i in roomInfo)
            {
                tbl_RoomBooking_Details roomDetails = new tbl_RoomBooking_Details();
                roomDetails.Booking_ID         = usrStay.Booking_ID;
                roomDetails.RoomID             = i.RoomID;
                roomDetails.NoOfPerson         = i.NoOfPerson;
                roomDetails.ExtraBed           = i.ExtraBed;
                roomDetails.ComplementaryStays = i.ComplementaryStays;
                roomDetails.TAmtPerRoom        = i.TAmtPerRoom;
                context.tbl_RoomBooking_Details.Add(roomDetails);
                context.SaveChanges();
            }

            return(Json("RoomBooked"));
        }
        public JsonResult AddNewStaff(Profile newMember)
        {
            //------------------------------for Custom MemberID-----------------------------
            var date = DateTime.Today;
            //var dateforcustomMemberID = date.ToString("yyyyMMdd");
            //var customMemberID = "";
            //var data = context.tbl_Profile.Where(o => o.Walk_In_Member != true && o.UserType == 3).ToList();
            //if (data.Count != 0)
            //{
            //    var lastRec = data.LastOrDefault();
            //    if (lastRec.CustomMemberID != null && lastRec.CustomMemberID != "")
            //    {
            //        if (lastRec.CustomMemberID.Count(x => x == '-') != 0)
            //        {
            //            customMemberID = "CWC" + dateforcustomMemberID + "001";
            //        }
            //        else
            //        {
            //            string dateSub = lastRec.CustomMemberID.Substring(3, 8);
            //            if (dateforcustomMemberID == dateSub)
            //            {
            //                string seriesSub = lastRec.CustomMemberID.Substring(11);
            //                int series = Convert.ToInt32(seriesSub);
            //                series += 1;
            //                customMemberID = "CWC" + dateSub + series.ToString("000");
            //            }
            //            else
            //            {
            //                customMemberID = "CWC" + dateforcustomMemberID + "001";
            //            }
            //        }
            //    }
            //    else
            //    {
            //        customMemberID = "CWC" + dateforcustomMemberID + "001";
            //    }
            //}
            //else
            //{
            //    customMemberID = "CWC" + dateforcustomMemberID + "001";
            //}

            //-----------------------------------------------------------
            int         currentUserTypeLoggedin = Convert.ToInt32(Request.Cookies["UserType"].Value);
            tbl_Profile prf = new tbl_Profile();

            prf.F_Name             = newMember.F_Name;
            prf.L_Name             = newMember.L_Name;
            prf.Address            = newMember.Address;
            prf.Email              = newMember.Email;
            prf.PhoneNo            = newMember.PhoneNo;
            prf.DOB                = newMember.DOB;
            prf.City               = newMember.City;
            prf.State              = newMember.State;
            prf.Status             = true;
            prf.EmailNotifications = newMember.EmailNotifications;
            prf.UserType           = newMember.UserType;
            //prf.Password = newMember.Password;
            prf.FatherName = newMember.FatherName;
            // prf.Reference_Of_Walk_In = newMember.Reference_Of_Walk_In;
            //prf.CustomMemberID = customMemberID;
            prf.AddedBy          = Request.Cookies["AddedBy"].Value;
            prf.Walk_In_Member   = false;
            prf.Additional_Notes = newMember.Additional_Notes;
            //prf.Addon_Member = newMember.Addon_Member;
            //prf.Relationship = newMember.Relationship;
            prf.JoiningDate = newMember.Staff_JoiningDate;
            if (newMember.AadharNo != null && newMember.AadharNo != "")
            {
                prf.AadharNo = newMember.AadharNo;
            }

            if (newMember.PAN_Card != null && newMember.PAN_Card != "")
            {
                prf.PAN_Card = newMember.PAN_Card;
            }

            if (currentUserTypeLoggedin == 2)
            {
                prf.NewUsrBySuperApprv = false;
            }
            else
            {
                prf.NewUsrBySuperApprv = true;
            }
            prf.DelUsrBySuperApprv = false;
            context.tbl_Profile.Add(prf);
            context.SaveChanges();

            int id = prf.ID;

            //string expDate = "";
            //if (id != 0)
            //{
            //    //var date = DateTime.Today;
            //    string DateFormat = date.ToString(@"MM\/dd\/yyyy");
            //    if (newMember.MembershipPlanIDForUser != 0 && newMember.MembershipPlanIDForUser != null)
            //    {
            //        string[] expiredate = newMember.MembershipJoiningDate.Split('/');
            //        var expireFullDate = new DateTime(Convert.ToInt32(expiredate[2]), Convert.ToInt32(expiredate[0]), Convert.ToInt32(expiredate[1]));
            //        var getMembershipPlanYear = context.tbl_MembershipPlans.SingleOrDefault(py => py.ID == newMember.MembershipPlanIDForUser);
            //        int planYear = getMembershipPlanYear.MembershipPlanForYear;
            //        tbl_UserMembership n = new tbl_UserMembership();
            //        n.UserID = id;
            //        n.MembershipID = newMember.MembershipPlanIDForUser;
            //        n.MembershipJoiningDate = newMember.MembershipJoiningDate;
            //        n.MembershipExpiryDate = expireFullDate.AddYears(planYear).ToString(@"MM\/dd\/yyyy");
            //        //n.MembershipPlanForYear = newMember.PlanForYear;
            //        context.tbl_UserMembership.Add(n);
            //        context.SaveChanges();

            //        expDate = expireFullDate.AddYears(planYear).ToString(@"MM\/dd\/yyyy");
            //    }

            //    tbl_MembersBillingDetails bill = new tbl_MembersBillingDetails();

            //    var billingDetails = JsonConvert.DeserializeObject<BillingDetails>(newMember.billingDetailsInJson);


            //    bill.Mode_Of_Payment = billingDetails.Mode_Of_Payment;
            //    bill.TotalAmount = billingDetails.Amount_Paid;

            //    if (billingDetails.Cheque_No != "" && billingDetails.Cheque_No != null)
            //        bill.Cheque_No = billingDetails.Cheque_No;
            //    else
            //        bill.Cheque_No = null;

            //    if (billingDetails.BankName != "" && billingDetails.BankName != null)
            //        bill.BankName = billingDetails.BankName;
            //    else
            //        bill.BankName = null;

            //    bill.UserID = id;

            //    bill.Payment_Date = DateFormat;

            //    context.tbl_MembersBillingDetails.Add(bill);
            //    context.SaveChanges();

            //===================================================================================

            if (newMember.MemberPhoto != null)
            {
                string directoryPath = Server.MapPath("/images/MembersPhotoFolder/" + id);
                if (!Directory.Exists(directoryPath))
                {
                    Directory.CreateDirectory(directoryPath);
                }
                var    fileName = Path.GetFileName(newMember.MemberPhoto.FileName);
                string _name    = Guid.NewGuid().ToString() + fileName;
                var    comPath  = Server.MapPath("/images/MembersPhotoFolder/" + id + "/") + _name;
                var    path     = "/images/MembersPhotoFolder/" + id + "/" + _name;
                newMember.MemberPhoto.SaveAs(comPath);
                tbl_MembersPhoto photo = new tbl_MembersPhoto();
                photo.UserID          = id;
                photo.MemberImagePath = path;
                context.tbl_MembersPhoto.Add(photo);
                context.SaveChanges();
            }
            if (newMember.MemberDocuments != null)
            {
                for (int i = 0; i < newMember.MemberDocuments.Count; i++)
                {
                    HttpPostedFileBase file          = newMember.MemberDocuments[i];
                    string             directoryPath = Server.MapPath("/images/MembersDocumentsFolder/" + id);
                    if (!Directory.Exists(directoryPath))
                    {
                        Directory.CreateDirectory(directoryPath);
                    }
                    var    fileName = Path.GetFileName(file.FileName);
                    string _name    = Guid.NewGuid().ToString() + fileName;
                    var    comPath  = Server.MapPath("/images/MembersDocumentsFolder/" + id + "/") + _name;
                    var    path     = "/images/MembersDocumentsFolder/" + id + "/" + _name;
                    file.SaveAs(comPath);
                    tbl_MembersDocs photo = new tbl_MembersDocs();
                    photo.UserID         = id;
                    photo.MemberDocsPath = path;
                    context.tbl_MembersDocs.Add(photo);
                    context.SaveChanges();
                }
                //}
                //===================================================================================


                //    HttpPostedFileBase imageFile = Request.Files["MemberPhoto"];
                //    if (imageFile != null)
                //    {
                //        string directoryPath = Server.MapPath("/MembersPhotoFolder/" + id);
                //        if (!Directory.Exists(directoryPath))
                //        {
                //            Directory.CreateDirectory(directoryPath);
                //        }
                //        var fileName = Path.GetFileName(imageFile.FileName);
                //        string _name = Guid.NewGuid().ToString() + fileName;
                //        var comPath = Server.MapPath("/MembersPhotoFolder/" + id + "/") + _name;
                //        var path = "/MembersPhotoFolder/" + id + "/" + _name;
                //        imageFile.SaveAs(comPath);
                //        tbl_MembersPhoto photo = new tbl_MembersPhoto();
                //        photo.UserID = id;
                //        photo.MemberImagePath = path;
                //        context.tbl_MembersPhoto.Add(photo);
                //        context.SaveChanges();
                //    }
                //}
            }
            var result = new
            {
                currentUserTypeLoggedin = currentUserTypeLoggedin,
                //userID = id,
                //ExpiryDate = expDate
            };

            return(Json(result));
        }