public ActionResult Reject(long Id)
 {
     try
     {
         CLayer.B2B data = BLayer.B2B.Get(Id);
         BLayer.B2B.SetStatus(Id, (int)CLayer.ObjectStatus.StatusType.Rejected);
         if (data.UserType == (int)CLayer.Role.Roles.Supplier)
         {
             return(RedirectToAction("Supplier"));
         }
         else if (data.UserType == (int)CLayer.Role.Roles.Agent)
         {
             return(RedirectToAction("TravelAgent"));
         }
         else if (data.UserType == (int)CLayer.Role.Roles.Affiliate)
         {
             return(RedirectToAction("Affiliates"));
         }
         return(RedirectToAction("Corporate"));
     }
     catch (Exception ex)
     {
         Common.LogHandler.HandleError(ex);
         return(Redirect("~/Admin/ErrorPage"));
     }
 }
Exemplo n.º 2
0
        public ActionResult Details(long?id)
        {
            Models.UserDetailModel details = null;
            CLayer.User            data    = BLayer.User.Get(id.Value);
            if (data != null)
            {
                details = new Models.UserDetailModel()
                {
                    UserId       = data.UserId,
                    SalutationId = data.SalutationId,
                    FirstName    = data.FirstName,
                    LastName     = data.LastName,
                    DateOfBirth  = data.DateOfBirth.ToShortDateString(),
                    Status       = data.Status,
                    Email        = data.Email,
                    CreatedDate  = data.CreatedDate,
                    DeletedDate  = data.DeletedDate,
                    LastLoginOn  = data.LastLoginOn,
                    Phone        = data.Phone,
                    Mobile       = data.Mobile,
                    PANNo        = data.PANNo
                };
            }
            CLayer.B2B b2b = BLayer.B2B.Get(id.Value);
            if (b2b != null)
            {
                details.MaxStaff = b2b.MaximumStaff;
                details.Name     = b2b.Name;
                details.PANNo    = b2b.PANNo;
            }

            CLayer.Address adrs = BLayer.Address.GetPrimaryOnUser(id.Value);
            if (adrs != null)
            {
                details.Address   = adrs.AddressText;
                details.AddressId = adrs.AddressId;
                details.State     = adrs.State;

                details.CountryId = adrs.CountryId;
                details.Phone     = adrs.Phone;
                details.Mobile    = adrs.Mobile;
                details.ZipCode   = adrs.ZipCode;
                details.CityId    = adrs.CityId;
                details.City      = adrs.City;
                if (adrs.CityId > 0)
                {
                    details.City   = BLayer.City.Get(adrs.CityId).Name;
                    details.CityId = adrs.CityId;
                }
                else
                {
                    if (adrs.City != null && adrs.City != "")
                    {
                        details.City = adrs.City;
                    }
                }
                details.LoadPlaces();
            }
            return(View(details));
        }
Exemplo n.º 3
0
        public CLayer.B2B GetbookingcreditforCorte(long b2bId)
        {
            CLayer.B2B b2b = null;
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pB2BId", DataPlug.DataType._BigInt, b2bId));
            DataTable dt = Connection.GetTable("b2bcorporate_Getbookingcredits", param);

            if (dt.Rows.Count > 0)
            {
                b2b                     = new CLayer.B2B();
                b2b.B2BId               = Connection.ToLong(dt.Rows[0]["B2BId"]);
                b2b.Name                = Connection.ToString(dt.Rows[0]["Name"]);
                b2b.UserCode            = Connection.ToString(dt.Rows[0]["UserCode"]);
                b2b.MarkupPercent       = Connection.ToDecimal(dt.Rows[0]["MarkupPercent"]);
                b2b.CommissionPercent   = Connection.ToDecimal(dt.Rows[0]["CommissionPercent"]);
                b2b.ServiceTaxRegNo     = Connection.ToString(dt.Rows[0]["ServiceTaxRegNo"]);
                b2b.VATRegNo            = Connection.ToString(dt.Rows[0]["VATRegNo"]);
                b2b.MaximumStaff        = Connection.ToInteger(dt.Rows[0]["MaximumStaff"]);
                b2b.RequestStatus       = Connection.ToInteger(dt.Rows[0]["RequestStatus"]);
                b2b.Email               = Connection.ToString(dt.Rows[0]["Email"]);
                b2b.UserId              = Connection.ToLong(dt.Rows[0]["UserId"]);
                b2b.CompanyRegNo        = Connection.ToString(dt.Rows[0]["CompanyRegNo"]);
                b2b.UserType            = Connection.ToInteger(dt.Rows[0]["UserType"]);
                b2b.PropertyDescription = Connection.ToString(dt.Rows[0]["PropertyDescription"]);
                b2b.AvailableProperties = Connection.ToInteger(dt.Rows[0]["AvailableProperties"]);
                b2b.PANNo               = Connection.ToString(dt.Rows[0]["PANNo"]);
                b2b.ContactDesignation  = Connection.ToString(dt.Rows[0]["ContactDesignation"]);
                b2b.IsCreditBooking     = Connection.ToInteger(dt.Rows[0]["IsCreditBooking"]);
                b2b.CreditDays          = Connection.ToInteger(dt.Rows[0]["CreditDays"]);
                b2b.CreditAmount        = Connection.ToDecimal(dt.Rows[0]["CreditAmount"]);
                b2b.TotalCreditAmount   = Connection.ToDecimal(dt.Rows[0]["TotalCreditAmount"]);
            }
            return(b2b);
        }
Exemplo n.º 4
0
        public void SaveAffiliate(CLayer.B2B data)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pB2BId", DataPlug.DataType._BigInt, data.B2BId));
            param.Add(Connection.GetParameter("pCompanyRegNo", DataPlug.DataType._Varchar, data.CompanyRegNo));
            Connection.ExecuteQuery("b2b_SaveAffiliate", param);
        }
Exemplo n.º 5
0
 public static long Savedoc(CLayer.B2B data)
 {
     DataLayer.B2B     b2b = new DataLayer.B2B();
     CLayer.Role.Roles rle = BLayer.User.GetRole(data.UserId);
     data.UserCode = GetCode(data.UserId, rle);
     data.Validate();
     return(b2b.Savedoc(data));
 }
        public ActionResult SupplierUpdate(Models.UserDetailModel data)
        {
            CLayer.User usr = new CLayer.User()
            {
                UserId       = data.UserId,
                Businessname = data.Name,    //Businessname
                SalutationId = data.SalutationId,
                FirstName    = data.FirstName,
                LastName     = data.FirstName,
                Email        = data.Email
            };
            BLayer.User.Update(usr);

            CLayer.B2B b2b = new CLayer.B2B()
            {
                B2BId = data.UserId,
                Name  = data.Name,   //Businessname
                PropertyDescription = data.PropertyDescription,
                AvailableProperties = data.AvailableProperties
            };


            BLayer.B2B.Update(b2b);
            //if (data.UserId > 0)
            //{
            //    ViewData["B2BId"] = data.UserId;
            //}
            CLayer.Address adrs = new CLayer.Address()
            {
                AddressId   = data.AddressId,
                UserId      = data.UserId,
                AddressText = data.Address,
                //CityId = data.CityId,
                State       = data.State,
                CountryId   = data.CountryId,
                Phone       = data.Phone,
                ZipCode     = data.ZipCode,
                Mobile      = data.Mobile,
                AddressType = (int)CLayer.Address.AddressTypes.Primary
            };
            if (data.CityId > 0)
            {
                adrs.City   = BLayer.City.Get(data.CityId).Name;
                adrs.CityId = data.CityId;
            }
            else
            {
                if (data.City != null && data.City != "")
                {
                    adrs.City = data.City;
                }
            }


            BLayer.Address.Save(adrs);
            ViewBag.Message = "Your details updated successfully";
            return(RedirectToAction("SupplierDetails", new { id = data.UserId }));
        }
Exemplo n.º 7
0
        public void SaveSupplierForAffiliate(CLayer.B2B data)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pB2BId", DataPlug.DataType._BigInt, data.B2BId));
            param.Add(Connection.GetParameter("pUserId", DataPlug.DataType._BigInt, data.UserId));
            param.Add(Connection.GetParameter("pUserType", DataPlug.DataType._BigInt, data.UserType));
            Connection.ExecuteQuery("b2b_SaveSupplierForAffiliate", param);
        }
Exemplo n.º 8
0
        public long SaveBusinessname(CLayer.B2B data)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pB2BId", DataPlug.DataType._BigInt, data.B2BId));
            param.Add(Connection.GetParameter("pName", DataPlug.DataType._Varchar, data.Name));
            param.Add(Connection.GetParameter("pContactDesignation", DataPlug.DataType._Varchar, data.ContactDesignation));
            object result = Connection.ExecuteQueryScalar("b2b_SaveBusinessname", param);

            return(Connection.ToInteger(result));
        }
Exemplo n.º 9
0
 public ActionResult AddSupplier(long UserId, long B2bId)
 {
     //long B2bId = 0;
     //long.TryParse(User.Identity.GetUserId(), out B2bId);
     CLayer.B2B data = new CLayer.B2B();
     data.B2BId    = B2bId;
     data.UserId   = UserId;
     data.UserType = (int)CLayer.Role.Roles.Supplier;
     BLayer.B2B.SaveSupplierForAffiliate(data);
     //return RedirectToAction("Index", "SearchSupplier", new { B2bId=B2bId});
     return(RedirectToAction("Details", "Affiliate", new { id = B2bId, B2bId = B2bId, activeTab = 4 }));
 }
Exemplo n.º 10
0
        public ActionResult AddSupplier(long UserId)
        {
            long B2bId = 0;

            long.TryParse(User.Identity.GetUserId(), out B2bId);
            CLayer.B2B data = new CLayer.B2B();
            data.B2BId    = B2bId;
            data.UserId   = UserId;
            data.UserType = (int)CLayer.Role.Roles.Supplier;
            BLayer.B2B.SaveSupplierForAffiliate(data);
            return(RedirectToAction("Index", "SupplierList"));
        }
Exemplo n.º 11
0
        public long Savedoc(CLayer.B2B data)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pB2BId", DataPlug.DataType._BigInt, data.B2BId));
            param.Add(Connection.GetParameter("pServiceTaxRegNo", DataPlug.DataType._Varchar, data.ServiceTaxRegNo));
            param.Add(Connection.GetParameter("pVATRegNo", DataPlug.DataType._Varchar, data.VATRegNo));
            param.Add(Connection.GetParameter("pPANNo", DataPlug.DataType._Varchar, data.PANNo));
            //param.Add(Connection.GetParameter("pContactDesignation", DataPlug.DataType._Varchar, data.ContactDesignation));
            object result = Connection.ExecuteQueryScalar("b2b_Savedoc", param);

            return(Connection.ToInteger(result));
        }
Exemplo n.º 12
0
        public int SaveCBookCredit(CLayer.B2B data)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pB2BId", DataPlug.DataType._BigInt, data.UserId));
            param.Add(Connection.GetParameter("pIsCreditBooking", DataPlug.DataType._Int, data.IsCreditBooking));
            param.Add(Connection.GetParameter("pCreditDays", DataPlug.DataType._BigInt, data.CreditDays));
            param.Add(Connection.GetParameter("pCreditAmount", DataPlug.DataType._Decimal, data.CreditAmount));
            param.Add(Connection.GetParameter("pTotalCreditAmount", DataPlug.DataType._Decimal, data.TotalCreditAmount));
            object result = Connection.ExecuteQueryScalar("Corporatebookingcredits_Save", param);

            return(Connection.ToInteger(result));
        }
Exemplo n.º 13
0
        public List <CLayer.B2B> GetEmptyCodeRows()
        {
            DataTable         dt     = Connection.GetTable("b2b_GetAllEmptyCodeRows");
            List <CLayer.B2B> result = new List <CLayer.B2B>();

            CLayer.B2B temp;
            foreach (DataRow dr in dt.Rows)
            {
                temp          = new CLayer.B2B();
                temp.B2BId    = Connection.ToLong(dr["B2BId"]);
                temp.UserType = Connection.ToInteger(dr["UserType"]);
                result.Add(temp);
            }
            return(result);
        }
Exemplo n.º 14
0
        public long Update(CLayer.B2B data)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pB2BId", DataPlug.DataType._BigInt, data.B2BId));
            param.Add(Connection.GetParameter("pBusinessName", DataPlug.DataType._Varchar, data.Name));
            //param.Add(Connection.GetParameter("pPANNo", DataPlug.DataType._Varchar, data.PANNo));
            param.Add(Connection.GetParameter("pPropertyDescription", DataPlug.DataType._Varchar, data.PropertyDescription));
            param.Add(Connection.GetParameter("pAvailableProperties", DataPlug.DataType._Int, data.AvailableProperties));
            param.Add(Connection.GetParameter("pContactDesignation", DataPlug.DataType._Varchar, data.ContactDesignation));
            //param.Add(Connection.GetParameter("pPANNo", DataPlug.DataType._Varchar, data.PANNo));
            object result = Connection.ExecuteQueryScalar("b2b_Update", param);

            return(Connection.ToInteger(result));
        }
Exemplo n.º 15
0
 public ActionResult AllowCBookSamedaybook(Models.UserDetailModel data)
 {
     try
     {
         CLayer.B2B book = new CLayer.B2B()
         {
             IsCorpBookingtoday = data.IsCorpBookingtoday,
             UserId             = data.UserId
         };
         long id = BLayer.B2B.AllowCBookSamedaybook(book.IsCorpBookingtoday, book.UserId);
         return(null);
     }
     catch (Exception ex)
     {
         Common.LogHandler.HandleError(ex);
         return(Redirect("~/Admin/ErrorPage")); //
     }
 }
Exemplo n.º 16
0
        public ActionResult BookingModify(long BookingId)
        {
            Models.OfflinePropertyBookingModel model = new Models.OfflinePropertyBookingModel();
            long PropertyId = BLayer.Bookings.GetPropertyId(BookingId);

            CLayer.Property Pdata   = BLayer.Property.Get(PropertyId);
            CLayer.B2B      supdata = BLayer.B2B.Get(Pdata.OwnerId);

            CLayer.Booking            offedit = BLayer.Bookings.GetBookDetailsByBookingId(BookingId);
            List <CLayer.BookingItem> Items   = BLayer.BookingItem.GetAllDetailsforoffline(BookingId);

            model.PropertyId        = PropertyId;
            model.PropertyName      = Pdata.Title;
            model.PropertyAddress   = Pdata.Address;
            model.PropertyCity      = Pdata.CityId;
            model.PropertyCityname  = Pdata.City;
            model.PropertyState     = Pdata.State;
            model.PropertyCountry   = Pdata.Country;
            model.PropertyContactNo = Pdata.Phone;
            model.PropertyEmail     = Pdata.Email;
            model.SupplierName      = supdata.Name;


            model.Accommodationid     = offedit.AccommodationId;
            model.Accommodationtypeid = offedit.AccommodationTypeId;
            model.AccommodatoinType   = Convert.ToInt16(offedit.AccommodationType);
            string ccc = BLayer.Accommodation.GetAccommodationTitle(offedit.AccommodationId);

            model.AccommodationTypeName = ccc;
            model.StayCategoryid        = offedit.StayCategoryId;
            model.CheckIn  = offedit.CheckIn.ToString("dd/MM/yyyy");
            model.CheckOut = offedit.CheckOut.ToString("dd/MM/yyyy");
            //model.NoOfNight = offedit.NoOfNight;
            //model.NoOfRooms = offedit.NoOfRooms;
            model.NoOfPaxAdult   = offedit.NoOfAdults;
            model.NoOfPaxChild   = offedit.NoOfChildren;
            model.Type           = 2;
            model.bookingitmList = Items;
            model.Count          = Items.Count;

            model.BookingId  = BookingId;
            model.CustomerId = BLayer.Bookings.GetBookedByUserId(BookingId);
            return(View("_BookingModify", model));
        }
Exemplo n.º 17
0
        public long Save(CLayer.B2B data)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pB2BId", DataPlug.DataType._BigInt, data.B2BId));
            param.Add(Connection.GetParameter("pName", DataPlug.DataType._Varchar, data.Name));
            param.Add(Connection.GetParameter("pUserCode", DataPlug.DataType._Varchar, data.UserCode));
            param.Add(Connection.GetParameter("pMarkupPercent", DataPlug.DataType._Decimal, data.MarkupPercent));
            param.Add(Connection.GetParameter("pCommissionPercent", DataPlug.DataType._Decimal, data.CommissionPercent));
            param.Add(Connection.GetParameter("pServiceTaxRegNo", DataPlug.DataType._Varchar, data.ServiceTaxRegNo));
            param.Add(Connection.GetParameter("pVATRegNo", DataPlug.DataType._Varchar, data.VATRegNo));
            param.Add(Connection.GetParameter("pPANNo", DataPlug.DataType._Varchar, data.PANNo));
            //param.Add(Connection.GetParameter("pMaximumStaff", DataPlug.DataType._Int, data.MaximumStaff));
            param.Add(Connection.GetParameter("pPropertyDescription", DataPlug.DataType._Varchar, data.PropertyDescription));
            param.Add(Connection.GetParameter("pAvailableProperties", DataPlug.DataType._Int, data.AvailableProperties));
            param.Add(Connection.GetParameter("pContactDesignation", DataPlug.DataType._Varchar, data.ContactDesignation));
            object result = Connection.ExecuteQueryScalar("b2b_Save", param);

            return(Connection.ToInteger(result));
        }
Exemplo n.º 18
0
 public ActionResult SaveCBookCredit(Models.UserDetailModel data)
 {
     try
     {
         CLayer.B2B payment = new CLayer.B2B()
         {
             IsCreditBooking   = data.IsCreditBooking,
             CreditDays        = data.CreditDays,
             CreditAmount      = data.CreditAmount,
             TotalCreditAmount = data.CreditAmount,
             UserId            = data.UserId
         };
         long id = BLayer.B2B.SaveCBookCredit(payment);
         return(null);
     }
     catch (Exception ex)
     {
         Common.LogHandler.HandleError(ex);
         return(Redirect("~/Admin/ErrorPage")); //
     }
 }
 public ActionResult Details(long Id)
 {
     try
     {
         CLayer.B2B      data = BLayer.B2B.Get(Id);
         Models.B2BModel b2b  = new Models.B2BModel()
         {
             B2BId               = data.B2BId,
             UserId              = data.B2BId,
             Name                = data.Name,
             Email               = data.Email,
             UserType            = data.UserType,
             CompanyRegNo        = data.CompanyRegNo,
             ServiceTaxRegNo     = data.ServiceTaxRegNo,
             VATRegNo            = data.VATRegNo,
             RequestStatus       = data.RequestStatus,
             PropertyDescription = data.PropertyDescription,
             AvailableProperties = data.AvailableProperties,
             Addresses           = BLayer.Address.GetOnUser(data.B2BId)
         };
         b2b.BankDetails = new CLayer.BankAccount();
         b2b.BankDetails = BLayer.BankAccount.GetOnUser(data.B2BId);
         CLayer.User usr = BLayer.User.Get(Id);
         if (usr != null)
         {
             b2b.ContactName = usr.FirstName;
         }
         if (data.RequestStatus == (int)CLayer.ObjectStatus.StatusType.NotVerified ||
             data.RequestStatus == (int)CLayer.ObjectStatus.StatusType.Unread)
         {
             BLayer.B2B.SetStatus(Id, (int)CLayer.ObjectStatus.StatusType.Read);
         }
         return(View(b2b));
     }
     catch (Exception ex)
     {
         Common.LogHandler.HandleError(ex);
         return(Redirect("~/Admin/ErrorPage"));
     }
 }
 public ActionResult Delete(long Id)
 {
     CLayer.B2B data = BLayer.B2B.Get(Id);
     BLayer.B2B.Delete(Id);
     if (System.IO.Directory.Exists(Server.MapPath("~/Files/Users/" + Id.ToString())))
     {
         System.IO.Directory.Delete(Server.MapPath("~/Files/Users/" + Id.ToString()), true);
     }
     if (data.UserType == (int)CLayer.Role.Roles.Supplier)
     {
         return(RedirectToAction("Supplier", new { rejected = true }));
     }
     else if (data.UserType == (int)CLayer.Role.Roles.Agent)
     {
         return(RedirectToAction("TravelAgent", new { rejected = true }));
     }
     else if (data.UserType == (int)CLayer.Role.Roles.Affiliate)
     {
         return(RedirectToAction("Affiliates", new { rejected = true }));
     }
     return(RedirectToAction("Corporate", new { rejected = true }));
 }
Exemplo n.º 21
0
        public List <CLayer.B2B> SearchAffiliate(string name)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();

            param.Add(Connection.GetParameter("pName", DataPlug.DataType._Varchar, name));
            param.Add(Connection.GetParameter("pCorpStatus", DataPlug.DataType._Int, (int)CLayer.Role.Roles.Affiliate));
            DataTable dt = Connection.GetTable("b2b_SearchSupplier", param);

            List <CLayer.B2B> result = new List <CLayer.B2B>();

            CLayer.B2B temp;
            foreach (DataRow dr in dt.Rows)
            {
                temp          = new CLayer.B2B();
                temp.Name     = Connection.ToString(dr["Name"]);
                temp.B2BId    = Connection.ToLong(dr["B2BId"]);
                temp.UserCode = Connection.ToString(dr["UserCode"]);
                result.Add(temp);
            }

            return(result);
        }
Exemplo n.º 22
0
        public async Task <bool> ResendregemailCorp(long UserId, string Password)
        {
            try
            {
                string        message = "";
                Common.Mailer ml      = new Common.Mailer();
                CLayer.B2B    data    = BLayer.B2B.Get(UserId);

                UserManager <StayBazar.Lib.Security.IdentityUser> usrmngr = new UserManager <StayBazar.Lib.Security.IdentityUser>(new UserStore());
                String hashedNewPassword = usrmngr.PasswordHasher.HashPassword(Password);
                BLayer.User.SetPassword(UserId, hashedNewPassword);
                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                message = await Common.Mailer.MessageFromHtml(System.Configuration.ConfigurationManager.AppSettings.Get("B2BRegistration") + UserId.ToString() + "&pass="******"*****@*****.**");
                msg.Subject    = "Staybazar Account";
                msg.Body       = message;
                msg.IsBodyHtml = true;
                try
                {
                    await ml.SendMailAsyncForBooking(msg, Common.Mailer.MailType.Reservation);
                }
                catch (Exception ex)
                {
                    Common.LogHandler.HandleError(ex);
                }
                return(true);
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(false);
            }
        }
Exemplo n.º 23
0
        public ActionResult UserDocumentdataSave(Models.UserDocumentsModel data)
        {
            string b2bname = BLayer.B2BUser.Getb2bname(data.UserId);

            CLayer.B2B b2b = new CLayer.B2B()
            {
                Name            = b2bname,
                B2BId           = data.UserId,
                UserType        = data.UserType,
                ServiceTaxRegNo = data.ServiceTaxRegNo,
                PANNo           = data.PANNo,
                VATRegNo        = data.VATRegNo,
                //ContactDesignation = data.ContactDesignation
            };
            data.B2BId = BLayer.B2B.Savedoc(b2b);
            if (data.UserType == (int)CLayer.Role.Roles.Agent)
            {
                int    maxContentLength = 1024 * 1024;// 1 MB  //*3; //3 MB
                string extensions       = ConfigurationManager.AppSettings.Get("DocumentFileTypes");
                int    maxFileSize      = Convert.ToInt32(ConfigurationManager.AppSettings.Get("FileSizeInMB"));
                maxContentLength = maxContentLength * maxFileSize;
                //string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".pdf", ".doc", ".xlsx", ".docx", ".xls" };
                string[] allowedFileExtensions = extensions.Split(',');
                if (data.ServiceTaxReg != null || data.BusinessRegistrationCertificate != null ||
                    data.PANCard != null || data.CopyOfCheque != null || data.CorporateLogo != null)
                {
                    //data.ServiceTaxReg.ContentLength > 0 || data.BusinessRegistrationCertificate.ContentLength > 0 ||data.PANCard.ContentLength > 0 || data.CopyOfCheque.ContentLength > 0

                    //if (!allowedFileExtensions.Contains(data.ServiceTaxReg.FileName.Substring(data.ServiceTaxReg.FileName.LastIndexOf('.'))) ||
                    //    !allowedFileExtensions.Contains(data.BusinessRegistrationCertificate.FileName.Substring(data.BusinessRegistrationCertificate.FileName.LastIndexOf('.'))) ||
                    //    !allowedFileExtensions.Contains(data.PANCard.FileName.Substring(data.PANCard.FileName.LastIndexOf('.'))) ||
                    //    !allowedFileExtensions.Contains(data.CopyOfCheque.FileName.Substring(data.CopyOfCheque.FileName.LastIndexOf('.'))))
                    //{
                    //    ViewBag.Message = "Invalid document type. Please use these file types: " + string.Join(", ", allowedFileExtensions);
                    //    return View("TravelAgent", data);
                    //}
                    // if (data.ServiceTaxReg.ContentLength > maxContentLength ||
                    //    data.BusinessRegistrationCertificate.ContentLength > maxContentLength ||
                    //    data.PANCard.ContentLength > maxContentLength ||
                    //    data.CopyOfCheque.ContentLength > maxContentLength)
                    //{
                    //    ViewBag.Message = "Your file is too large, maximum allowed size is: 1 MB";
                    //}
                    //else
                    //{
                    data.UserType = (int)CLayer.Role.Roles.Agent;
                    Save(data);
                    //}
                }

                return(RedirectToAction("Details", "TravelAgent", new { id = data.UserId }));
            }
            else if (data.UserType == (int)CLayer.Role.Roles.Supplier)
            {
                int    maxContentLength = 1024 * 1024;// 1 MB  //*3; //3 MB
                string extensions       = ConfigurationManager.AppSettings.Get("DocumentFileTypes");
                int    maxFileSize      = Convert.ToInt32(ConfigurationManager.AppSettings.Get("FileSizeInMB"));
                maxContentLength = maxContentLength * maxFileSize;
                //string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".pdf", ".doc", ".xlsx", ".docx", ".xls" };
                string[] allowedFileExtensions = extensions.Split(',');

                if (data.ServiceTaxReg != null || data.VATReg != null)
                {
                    data.UserType = (int)CLayer.Role.Roles.Supplier;
                    Save(data);
                }
                else
                {
                    data.UserType = (int)CLayer.Role.Roles.Affiliate;
                    Save(data);
                    ViewBag.Message = "The files are not selected";
                }

                return(RedirectToAction("Details", "Supplier", new { id = data.UserId }));
            }
            else if (data.UserType == (int)CLayer.Role.Roles.Affiliate)
            {
                int    maxContentLength = 1024 * 1024;// 1 MB  //*3; //3 MB
                string extensions       = ConfigurationManager.AppSettings.Get("DocumentFileTypes");
                int    maxFileSize      = Convert.ToInt32(ConfigurationManager.AppSettings.Get("FileSizeInMB"));
                maxContentLength = maxContentLength * maxFileSize;
                //string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".pdf", ".doc", ".xlsx", ".docx", ".xls" };
                string[] allowedFileExtensions = extensions.Split(',');

                if (data.ServiceTaxReg != null || data.VATReg != null)
                {
                    data.UserType = (int)CLayer.Role.Roles.Affiliate;
                    Save(data);
                }
                else
                {
                    data.UserType = (int)CLayer.Role.Roles.Affiliate;
                    Save(data);
                    ViewBag.Message = "The files are not selected";
                }

                return(RedirectToAction("Details", "Affiliate", new { id = data.UserId }));
            }
            else if (data.UserType == (int)CLayer.Role.Roles.Corporate)
            {
                int    maxContentLength = 1024 * 1024;// 1 MB  //*3; //3 MB
                string extensions       = ConfigurationManager.AppSettings.Get("DocumentFileTypes");
                int    maxFileSize      = Convert.ToInt32(ConfigurationManager.AppSettings.Get("FileSizeInMB"));
                maxContentLength = maxContentLength * maxFileSize;
                //string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".pdf", ".doc", ".xlsx", ".docx", ".xls" };
                string[] allowedFileExtensions = extensions.Split(',');
                if (data.ServiceTaxReg != null || data.PANCard != null || data.CorporateLogo != null)
                {
                    data.UserType = (int)CLayer.Role.Roles.Corporate;
                    Save(data);
                }
                else
                {
                    data.UserType = (int)CLayer.Role.Roles.Corporate;
                    Save(data);
                    ViewBag.Message = "The files are not selected";
                }
                return(RedirectToAction("Details", "Corporate", new { id = data.UserId }));
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 24
0
 public static long Update(CLayer.B2B data)
 {
     DataLayer.B2B user = new DataLayer.B2B();
     data.Validate();
     return(user.Update(data));
 }
Exemplo n.º 25
0
 public static long SaveBusinessname(CLayer.B2B data)
 {
     DataLayer.B2B b2b = new DataLayer.B2B();
     data.Validate();
     return(b2b.SaveBusinessname(data));
 }
Exemplo n.º 26
0
        public ActionResult Update(Models.UserDetailModel data)
        {
            if (ModelState.IsValid)
            {
                CLayer.User usr = new CLayer.User()
                {
                    UserId       = data.UserId,
                    SalutationId = data.SalutationId,
                    FirstName    = data.FirstName,
                    LastName     = data.FirstName,
                    Businessname = data.Name,//Businessname
                    Email        = data.Email
                };
                long UserId = BLayer.User.Update(usr);
                if (UserId > 0)
                {
                    CLayer.B2B b2b = new CLayer.B2B()
                    {
                        B2BId = data.UserId,
                        Name  = data.Name,//Businessname
                        ContactDesignation = data.ContactDesignation
                    };
                    BLayer.B2B.Update(b2b);

                    CLayer.Address adrs = new CLayer.Address()
                    {
                        AddressId   = data.AddressId,
                        UserId      = data.UserId,
                        AddressText = data.Address,
                        // CityId = data.CityId,
                        State       = data.State,
                        CountryId   = data.CountryId,
                        Phone       = data.Phone,
                        ZipCode     = data.ZipCode,
                        Mobile      = data.Mobile,
                        AddressType = (int)CLayer.Address.AddressTypes.Normal
                    };


                    if (data.CityId > 0)
                    {
                        adrs.City   = BLayer.City.Get(data.CityId).Name;
                        adrs.CityId = data.CityId;
                    }
                    else
                    {
                        if (data.City != null && data.City != "")
                        {
                            adrs.City = data.City;
                        }
                    }
                    BLayer.Address.Save(adrs);

                    //billing address Save
                    CLayer.Address BillingAddress;
                    if (!data.IsClicked)
                    {
                        BillingAddress = new CLayer.Address()
                        {
                            AddressId   = data.BillingAddressId,
                            AddressText = data.BillingAddress,
                            ZipCode     = data.BillingZipCode,
                            UserId      = data.UserId,
                            CityId      = data.BillingCityId,
                            State       = data.BillingState,
                            CountryId   = data.BillingCountryId,
                            Phone       = data.Phone,
                            Mobile      = data.Mobile,
                            AddressType = (int)CLayer.Address.AddressTypes.Primary
                        };
                        if (data.BillingCity != null && data.BillingCity != "")
                        {
                            BillingAddress.City = data.BillingCity;
                        }
                        if (data.BillingCityId > 0)
                        {
                            BillingAddress.City = BLayer.City.Get(data.BillingCityId).Name;
                        }
                        BLayer.Address.Save(BillingAddress);
                    }
                    else
                    {
                        BillingAddress = new CLayer.Address()
                        {
                            AddressId   = data.BillingAddressId,
                            AddressText = data.Address,
                            UserId      = data.UserId,
                            ZipCode     = data.ZipCode,
                            CityId      = data.CityId,
                            City        = data.City,
                            State       = data.State,
                            CountryId   = data.CountryId,
                            Phone       = data.Phone,
                            Mobile      = data.Mobile,
                            AddressType = (int)CLayer.Address.AddressTypes.Primary
                        };
                        if (data.City != null && data.City != "")
                        {
                            BillingAddress.City = data.City;
                        }
                        if (data.CityId > 0)
                        {
                            BillingAddress.City = BLayer.City.Get(data.CityId).Name;
                        }
                        BLayer.Address.Save(BillingAddress);
                    }

                    ViewBag.Message = "Your details updated successfully";
                    return(RedirectToAction("Details", new { id = data.UserId }));
                }
                else
                {
                    ViewBag.Message = "The email id already used by someone else";
                }
            }
            else
            {
                var    errors = ModelState.Values.SelectMany(v => v.Errors);
                string err    = "";
                foreach (ModelError me in errors)
                {
                    err += me.ErrorMessage.ToString();
                }
                ViewBag.Message = err;
            }
            return(View("Details", data));
        }
Exemplo n.º 27
0
        public ActionResult Details(long id)
        {
            Models.UserDetailModel details = null;
            CLayer.User            data    = BLayer.User.Get(id);
            if (data != null)
            {
                // details.FullName = data.FirstName + data.LastName;
                details = new Models.UserDetailModel()
                {
                    UserId                        = data.UserId,
                    SalutationId                  = data.SalutationId,
                    FirstName                     = data.FirstName,
                    LastName                      = data.LastName,
                    DateOfBirth                   = data.DateOfBirth.ToShortDateString(),
                    Status                        = data.Status,
                    Email                         = data.Email,
                    CreatedDate                   = data.CreatedDate,
                    DeletedDate                   = data.DeletedDate,
                    LastLoginOn                   = data.LastLoginOn,
                    CustomerPaymentMode           = data.CustomerPaymentMode,
                    CustomerPaymentModeCreditDays = data.CustomerPaymentModeCreditDays
                };
            }
            CLayer.B2B b2b = BLayer.B2B.Get(id);
            if (b2b != null)
            {
                details.MaxStaff     = b2b.MaximumStaff;
                details.Name         = b2b.Name;
                details.CreditPeriod = b2b.CreditPeriod;
            }
            CLayer.Address adrs = BLayer.Address.GetPrimaryOnUser(id);
            if (adrs != null)
            {
                details.Address   = adrs.AddressText;
                details.AddressId = adrs.AddressId;
                details.State     = adrs.State;

                details.CountryId = adrs.CountryId;
                details.Phone     = adrs.Phone;
                details.Mobile    = adrs.Mobile;
                details.ZipCode   = adrs.ZipCode;
                if (adrs.CityId > 0)
                {
                    details.City   = BLayer.City.Get(adrs.CityId).Name;
                    details.CityId = adrs.CityId;
                }
                else
                {
                    if (adrs.City != null && adrs.City != "")
                    {
                        details.City = adrs.City;
                    }
                }
            }


            CLayer.Address BillingAddress = BLayer.Address.GetBillingAddress(id);
            if (BillingAddress != null)
            {
                details.BillingAddressType = BillingAddress.BillingAddressType;
                details.BillingAddressId   = BillingAddress.BillingAddressId;
                details.BillingAddress     = BillingAddress.BillingAddress;
                details.BillingCityId      = BillingAddress.BillingCityId;
                details.BillingState       = BillingAddress.BillingState;
                details.BillingCity        = BillingAddress.BillingCity;
                details.BillingCountryId   = BillingAddress.BillingCountryId;
                details.BillingZipCode     = BillingAddress.BillingZipCode;
                details.IsClicked          = false;
            }
            else
            {
                details.BillingAddress     = details.Address;
                details.BillingAddressId   = 0;
                details.BillingAddress     = details.Address;
                details.BillingCityId      = details.CityId;
                details.BillingCity        = details.City;
                details.BillingState       = details.State;
                details.BillingCountryId   = details.CountryId;
                details.Phone              = details.Phone;
                details.Mobile             = details.Mobile;
                details.BillingAddressType = (int)CLayer.Address.AddressTypes.Primary;
                details.BillingZipCode     = details.ZipCode;
                details.IsClicked          = true;
            }

            if (details.BillingZipCode == details.ZipCode && details.BillingAddress == details.Address && details.BillingCityId == details.CityId && details.BillingCity == details.City && details.BillingState == details.State && details.BillingCountryId == details.CountryId)
            {
                details.IsClicked = true;
            }



            details.LoadPlaces();

            return(View("~/Areas/Admin/Views/Corporate/Details.cshtml", details));
        }
Exemplo n.º 28
0
 public static void SaveSupplierForAffiliate(CLayer.B2B data)
 {
     DataLayer.B2B b2b = new DataLayer.B2B();
     b2b.SaveSupplierForAffiliate(data);
 }
Exemplo n.º 29
0
        private void Save2(Models.SupplierB2BModel data)
        {
            string tempName = "";

            if (data.UserType != (int)CLayer.Role.Roles.Agent)
            {
                if (data.ContactName == null)
                {
                    tempName = data.Name.TrimStart();//Business Name
                }
                else
                {
                    tempName = data.ContactName.TrimStart();// Name
                }
            }
            else
            {
                tempName = data.ContactName.TrimStart();
            }


            string tFirstName = tempName;
            string tLastName  = "";

            if (data.UserType == (int)CLayer.Role.Roles.Supplier)
            {
                tFirstName = tempName;
                tLastName  = tempName;
            }
            else if (data.UserType == (int)CLayer.Role.Roles.Corporate)
            {
                tFirstName = tempName;
                tLastName  = tempName;
            }
            else if (data.UserType == (int)CLayer.Role.Roles.Agent)
            {
                tFirstName = tempName;
                tLastName  = tempName;
            }
            else
            {
                // tFirstName = data.ContactName.TrimStart();
                // tLastName = data.ContactName.TrimStart();
                //---
                int firstspace = tempName.IndexOf(' ');
                if (firstspace > 1)
                {
                    if (firstspace < data.ContactName.Length - 1)
                    {
                        tFirstName = tempName.Split(' ')[0].ToString();
                        tLastName  = tempName.Substring(firstspace + 1, tempName.Length - tFirstName.Length - 1);
                    }
                }
                //----
            }
            CLayer.User usr = new CLayer.User()
            {
                SalutationId = 1,

                FirstName  = tFirstName,
                LastName   = "",
                Email      = data.Email,
                UserTypeId = data.UserType,
                Status     = (int)CLayer.ObjectStatus.StatusType.NotVerified
            };
            long UsrId = BLayer.User.Save(usr);

            CLayer.B2B b2b = new CLayer.B2B()
            {
                B2BId           = UsrId,
                Name            = data.Name,//Business Name
                ServiceTaxRegNo = data.ServiceTaxRegNo,
                PANNo           = data.PANNo,
                VATRegNo        = data.VATRegNo
            };

            if (data.UserType == (int)CLayer.Role.Roles.Supplier)
            {
                b2b.PropertyDescription = data.PropertyDescription;
                b2b.AvailableProperties = data.AvailableProperties;
            }
            data.B2BId = BLayer.B2B.Save(b2b);

            CLayer.Address address = new CLayer.Address()
            {
                AddressId   = 0,
                UserId      = UsrId,
                AddressText = data.Address,
                CityId      = data.CityId,
                State       = data.State,
                CountryId   = data.CountryId,
                ZipCode     = data.ZipCode,
                Phone       = data.Phone,
                Mobile      = data.Mobile,
                AddressType = (int)CLayer.Address.AddressTypes.Primary
            };

            if (data.City != null && data.City != "")
            {
                address.City = data.City;
            }
            if (data.CityId > 0)
            {
                address.City = BLayer.City.Get(data.CityId).Name;
            }
            address.AddressType = (int)CLayer.Address.AddressTypes.Primary;
            BLayer.Address.Save(address);

            #region Billing Address For Corporate have to be here before "save" line of the address object
            if (data.UserType == (int)CLayer.Role.Roles.Corporate)
            {
                if (data.BillingAddress != "")
                {
                    CLayer.Address billingaddress = new CLayer.Address()
                    {
                        AddressId   = 0,
                        UserId      = UsrId,
                        AddressText = data.BillingAddress,
                        CityId      = data.BillingCityId,
                        State       = data.BillingState,
                        CountryId   = data.BillingCountryId,
                        ZipCode     = "",
                        Phone       = "",
                        Mobile      = "",
                        AddressType = (int)CLayer.Address.AddressTypes.Primary
                    };
                    if (data.BillingCity != null && data.BillingCity != "")
                    {
                        billingaddress.City = data.BillingCity;
                    }
                    if (data.BillingCityId > 0)
                    {
                        billingaddress.City = BLayer.City.Get(data.BillingCityId).Name;
                    }
                    BLayer.Address.Save(billingaddress);
                }
            }
            #endregion

            #region Bank Account details for Supplier
            if (data.UserType == (int)CLayer.Role.Roles.Supplier)
            {
                if (data.BankName != "")
                {
                    CLayer.BankAccount account = new CLayer.BankAccount()
                    {
                        BankAccountId = 0,
                        UserId        = UsrId,
                        AccountName   = data.Name,//Business name
                        AccountNumber = data.AccountNumber,
                        BankName      = data.BankName,
                        BranchAddress = data.BranchAddress,
                        RTGSNumber    = data.RTGSNumber,
                        MICRCode      = data.MICRCode
                    };
                    BLayer.BankAccount.Save(account);
                }
            }
            #endregion

            #region File Attatchments
            if (data.ServiceTaxReg != null)
            {
                CLayer.UserFiles servicetax = new CLayer.UserFiles()
                {
                    UserId   = UsrId,
                    FileId   = 0,
                    FileName = UsrId.ToString() + DateTime.Now.ToString("ddMMyyyyHHmmss") + System.IO.Path.GetFileName(data.ServiceTaxReg.FileName),
                    Document = (int)CLayer.UserFiles.Documents.ServiceTaxRegNo
                };
                BLayer.UserFiles.Save(servicetax);
                SaveDocument(data.ServiceTaxReg, UsrId, servicetax.FileName);
            }
            if (data.VATReg != null)
            {
                CLayer.UserFiles vat = new CLayer.UserFiles()
                {
                    UserId   = UsrId,
                    FileId   = 0,
                    FileName = UsrId.ToString() + DateTime.Now.ToString("ddMMyyyyHHmmss") + System.IO.Path.GetFileName(data.VATReg.FileName),
                    Document = (int)CLayer.UserFiles.Documents.VATRegNo
                };
                BLayer.UserFiles.Save(vat);
                SaveDocument(data.VATReg, UsrId, vat.FileName);
            }
            if (data.BusinessRegistrationCertificate != null)
            {
                CLayer.UserFiles brc = new CLayer.UserFiles()
                {
                    UserId   = UsrId,
                    FileId   = 0,
                    FileName = UsrId.ToString() + DateTime.Now.ToString("ddMMyyyyHHmmss") + System.IO.Path.GetFileName(data.BusinessRegistrationCertificate.FileName),
                    Document = (int)CLayer.UserFiles.Documents.BusinessRegistrationCertificate
                };
                BLayer.UserFiles.Save(brc);
                SaveDocument(data.BusinessRegistrationCertificate, UsrId, brc.FileName);
            }
            if (data.PANCard != null)
            {
                CLayer.UserFiles pan = new CLayer.UserFiles()
                {
                    UserId   = UsrId,
                    FileId   = 0,
                    FileName = UsrId.ToString() + DateTime.Now.ToString("ddMMyyyyHHmmss") + System.IO.Path.GetFileName(data.PANCard.FileName),
                    Document = (int)CLayer.UserFiles.Documents.PANCard
                };
                BLayer.UserFiles.Save(pan);
                SaveDocument(data.PANCard, UsrId, pan.FileName);
            }
            if (data.CopyOfCheque != null)
            {
                CLayer.UserFiles cc = new CLayer.UserFiles()
                {
                    UserId   = UsrId,
                    FileId   = 0,
                    FileName = UsrId.ToString() + DateTime.Now.ToString("ddMMyyyyHHmmss") + System.IO.Path.GetFileName(data.CopyOfCheque.FileName),
                    Document = (int)CLayer.UserFiles.Documents.CopyOfCheque
                };
                BLayer.UserFiles.Save(cc);
                SaveDocument(data.CopyOfCheque, UsrId, cc.FileName);
            }
            #endregion
        }
        public ActionResult Update(Models.UserDetailModel data)
        {
            if (ModelState.IsValid)
            {
                CLayer.User usr = new CLayer.User()
                {
                    UserId       = data.UserId,
                    Businessname = data.Name,//Businessname
                    SalutationId = data.SalutationId,
                    FirstName    = data.FirstName,
                    LastName     = data.FirstName,
                    Email        = data.Email
                };
                BLayer.User.Update(usr);

                CLayer.B2B b2b = new CLayer.B2B()
                {
                    B2BId = data.UserId,
                    Name  = data.Name,//Businessname
                    PANNo = data.PANNo
                };
                BLayer.B2B.Update(b2b);

                CLayer.Address adrs = new CLayer.Address()
                {
                    AddressId   = data.AddressId,
                    UserId      = data.UserId,
                    AddressText = data.Address,
                    //CityId = data.CityId,
                    State       = data.State,
                    CountryId   = data.CountryId,
                    Phone       = data.Phone,
                    ZipCode     = data.ZipCode,
                    Mobile      = data.Mobile,
                    AddressType = (int)CLayer.Address.AddressTypes.Primary
                };
                if (data.CityId > 0)
                {
                    adrs.City   = BLayer.City.Get(data.CityId).Name;
                    adrs.CityId = data.CityId;
                }
                else
                {
                    if (data.City != null && data.City != "")
                    {
                        adrs.City = data.City;
                    }
                }


                BLayer.Address.Save(adrs);
                ViewBag.Message = "Your details updated successfully";
                return(RedirectToAction("Details", new { id = data.UserId, B2bId = data.AffiliateId }));
            }
            else
            {
                var    errors = ModelState.Values.SelectMany(v => v.Errors);
                string err    = "";
                foreach (ModelError me in errors)
                {
                    err += me.ErrorMessage.ToString();
                }
                ViewBag.Message = err;
            }
            return(View("Details", data));
        }