public ActionResult MyProducts()
        {
            int       id      = Convert.ToInt32(Session["userID"]);
            tblVendor tblVend = db.tblVendors.Find(id);

            if (tblVend == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            List <tblProduct> products = db.tblProducts.Where(vendId => vendId.venodrID == tblVend.vendorID).ToList();

            return(View(products));
        }
        public ActionResult AccountSettings()
        {
            int       id      = Convert.ToInt32(Session["userID"]);
            tblVendor tblVend = db.tblVendors.Find(id);

            if (tblVend == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            ViewBag.vendorType   = new SelectList(db.tblBusinessTypes, "businessTypeId", "businessTypeName", tblVend.vendorType);
            ViewBag.vendorGender = new SelectList(db.tblGenders, "genderId", "genderName", tblVend.vendorGender);
            return(View(tblVend));
        }
Example #3
0
        public IHttpActionResult DeletetblVendor(int id)
        {
            tblVendor tblVendor = db.tblVendors.Find(id);

            if (tblVendor == null)
            {
                return(NotFound());
            }

            db.tblVendors.Remove(tblVendor);
            db.SaveChanges();

            return(Ok(tblVendor));
        }
Example #4
0
        // GET: /Vendor/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblVendor tblvendor = await db.tblVendors.FindAsync(id);

            if (tblvendor == null)
            {
                return(HttpNotFound());
            }
            return(View(tblvendor));
        }
        private void VendorPayment_Load(object sender, EventArgs e)
        {
            cboPaymentMode.SelectedIndex = 0;
            List <tblVendor> vendors = _db.tblVendors.ToList();

            tblVendor tb = new tblVendor();

            tb.Name = "Choose Vendor";
            vendors.Insert(0, tb);
            cboVendor.DataSource    = vendors;
            cboVendor.DisplayMember = "Name";
            cboVendor.ValueMember   = "VendorId";
            cboVendor.SelectedIndex = 0;
        }
Example #6
0
        public async Task <ActionResult> Edit([Bind(Include = "VendorID,VendorName,VendorPriceRangeMinimum,VendorCapacityMinimum,VendorEnteredOn,VendorEnteredBy,VendorUpdatedOn,VendorUpdatedBy,VendorPriceRangeMaximum,MembershipID,VendorAddress,VendorCapacityMaximum,UserID,AreaCode,VendorImageSource,VendorDescription")] tblVendor tblvendor)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tblvendor).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.AreaCode     = new SelectList(db.tblAreas, "AreaCode", "AreaDescription", tblvendor.AreaCode);
            ViewBag.MembershipID = new SelectList(db.tblMemberships, "MembershipID", "MembershipCategory", tblvendor.MembershipID);
            ViewBag.UserID       = new SelectList(db.tblUsers, "UserID", "UserName", tblvendor.UserID);
            return(View(tblvendor));
        }
Example #7
0
        // GET: Vendors/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblVendor tblVendor = db.tblVendors.Find(id);

            if (tblVendor == null)
            {
                return(HttpNotFound());
            }
            return(View(tblVendor));
        }
        private void BtnSave_Click(object sender, EventArgs e)
        {
            tblVendor tb = new tblVendor();

            tb.Name        = txtName.Text;
            tb.Address     = txtAddress.Text;
            tb.PhoneNo     = txtPhoneNo.Text;
            tb.CompanyName = txtCompanyName.Text;
            tb.Email       = txtEmail.Text;
            _db.tblVendors.Add(tb);
            if (_db.SaveChanges() > 0)
            {
                LoadGrid();
                MessageBox.Show("Vendor Created");
            }
        }
Example #9
0
        public int PosttblVendor(tblVendor tblVendor)
        {
            tblVendor vendor = new tblVendor();

            vendor = db.tblVendors.Where(x => x.vendorName == tblVendor.vendorName && x.vendorAssetType == tblVendor.vendorAssetType).FirstOrDefault();
            if (vendor == null)
            {
                db.tblVendors.Add(tblVendor);
                db.SaveChanges();
                return(0);
            }
            else
            {
                return(1);
            }
        }
        // GET: Home/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblVendor tblVendor = db.tblVendors.Find(id);

            if (tblVendor == null)
            {
                return(HttpNotFound());
            }
            ViewBag.vendorType   = new SelectList(db.tblBusinessTypes, "businessTypeId", "businessTypeName", tblVendor.vendorType);
            ViewBag.vendorGender = new SelectList(db.tblGenders, "genderId", "genderName", tblVendor.vendorGender);
            return(View(tblVendor));
        }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            tblVendor result = get_Data_From_Form();

            result.VendorId = Int32.Parse(Request.QueryString["id"]);
            Vendor repository = new Vendor();

            if (repository.Update(result))
            {
                Response.Redirect("~/pages/vendor.aspx");
            }
            else
            {
                this.ShowErrorNotification("Error occured");
            }
        }
Example #12
0
        public object EditVendor(int VendorID, string VendorName, string Address, string Location, string VendorType, string Description, bool IsActive)
        {
            var       DC        = new DataClassesDataContext();
            tblVendor VendorObj = (from ob in DC.tblVendors
                                   where ob.VendorID == VendorID
                                   select ob).Single();

            VendorObj.VendorName  = VendorName;
            VendorObj.Address     = Address;
            VendorObj.Location    = Location;
            VendorObj.VendorType  = VendorType;
            VendorObj.Description = Description;
            VendorObj.IsActive    = IsActive;

            DC.SubmitChanges();
            return(true);
        }
Example #13
0
        // GET: /Vendor/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblVendor tblvendor = await db.tblVendors.FindAsync(id);

            if (tblvendor == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AreaCode     = new SelectList(db.tblAreas, "AreaCode", "AreaDescription", tblvendor.AreaCode);
            ViewBag.MembershipID = new SelectList(db.tblMemberships, "MembershipID", "MembershipCategory", tblvendor.MembershipID);
            ViewBag.UserID       = new SelectList(db.tblUsers, "UserID", "UserName", tblvendor.UserID);
            return(View(tblvendor));
        }
Example #14
0
        /// <summary>
        /// InsertVolunteerContext - Will insert a record into Volunteer table via SProc
        /// </summary>
        /// <param name="_cVolunteer"></param>
        public sp_Vendor_DM InsertVendorContext(ref sp_Vendor_DM _cVendor)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                var cVendor = new tblVendor
                {
                    ActiveFlg = _cVendor.ActiveFlg,
                    VendorID = _cVendor.VendorID,
                    VendorName = _cVendor.VendorName

                };
                context.tblVendors.Add(cVendor);
                context.SaveChanges();

                return _cVendor;
            }
        }
        private void Get_Vendor_Data_By_QueryString()
        {
            // Set up environment
            gridVendor.Visible = false;
            btnInsert.Visible  = false;
            btnUpdate.Visible  = true;
            linkBack.Visible   = true;


            Vendor    repository = new Vendor();
            tblVendor result     = repository.Get(Int32.Parse(Request.QueryString["id"]));

            txtName.Text        = result.VendorName;
            txtAddress.Text     = result.VendorAddress;
            txtEmail.Text       = result.VendorEmail;
            txtPhoneNumber.Text = result.VendorPhone;
            txtDescription.Text = result.VendorDescription;
        }
Example #16
0
 public bool Delete(int id)
 {
     try
     {
         tblVendor result = Get(id);
         if (result != null)
         {
             result.Deleted = true;
             repository.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #17
0
 public bool Update(tblVendor obj)
 {
     try
     {
         tblVendor result = Get(obj.VendorId);
         if (result != null)
         {
             repository.Entry(result).CurrentValues.SetValues(obj);
             repository.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #18
0
        /* Notices */

        /* Vendors */

        public object AddNewVendor(string VendorName, string Address, string Location, string VendorType, string Description)
        {
            var       DC        = new DataClassesDataContext();
            tblVendor VendorObj = new tblVendor();

            VendorObj.VendorName  = VendorName;
            VendorObj.Address     = Address;
            VendorObj.Location    = Location;
            VendorObj.VendorType  = VendorType;
            VendorObj.Description = Description;
            VendorObj.IsActive    = true;
            VendorObj.Ratings     = 0;
            VendorObj.RatingsNum  = 0;

            DC.tblVendors.InsertOnSubmit(VendorObj);
            DC.SubmitChanges();

            return(true);
        }
Example #19
0
        public ActionResult Login_Post(tblVendor vendor)
        {
            using (MVCFirstWebDataEntities db = new MVCFirstWebDataEntities())
            {
                tblVendor user = db.tblVendors.Where(x => x.vendorEmail == vendor.vendorEmail && x.vendorPassword == vendor.vendorPassword).FirstOrDefault();

                // TryUpdateModel(user, new string[] { "vendorEmail,vendorPassword"});
                if (user != null)
                {
                    Session["username"] = user.vendorEmail;
                    Session["userID"]   = user.vendorID;
                    return(RedirectToAction("DashBoard", "VendorAdminPanel"));
                }
            }

            ViewBag.vendorType   = new SelectList(db.tblBusinessTypes, "businessTypeId", "businessTypeName");
            ViewBag.vendorGender = new SelectList(db.tblGenders, "genderId", "genderName");
            return(View());
        }
Example #20
0
 public void AddPasswordRequestDate(string emailId)
 {
     try
     {
         using (StratasFairDBEntities context = new StratasFairDBEntities())
         {
             tblVendor _vendor = context.tblVendors.Where(x => x.EmailId == emailId).FirstOrDefault();
             _vendor.Pwd_Reset_Req_Date   = DateTime.UtcNow;
             _vendor.Pwd_Reset_Req_Status = 0;
             context.tblVendors.Attach(_vendor);
             context.Entry(_vendor).Property(x => x.Pwd_Reset_Req_Date).IsModified   = true;
             context.Entry(_vendor).Property(x => x.Pwd_Reset_Req_Status).IsModified = true;
             context.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #21
0
        public int ActDeact(VendorModel objectModel)
        {
            tblVendor tblVendorDb = new tblVendor();

            tblVendorDb.VendorId = objectModel.VendorId;
            tblVendorDb.Status   = objectModel.Status;

            context.tblVendors.Attach(tblVendorDb);
            context.Entry(tblVendorDb).Property(x => x.Status).IsModified = true;

            int count = context.SaveChanges();

            if (count == 1)
            {
                count = 0;
            }
            else
            {
                count = -1;
            }

            return(count);
        }
Example #22
0
        public long update(VendorModel objectModel)
        {
            long count = -2;

            tblVendor tblVendorDb = new tblVendor();

            tblVendorDb.VendorName                 = objectModel.VendorName;
            tblVendorDb.EmailId                    = objectModel.EmailId;
            tblVendorDb.DisciplineId               = objectModel.DisciplineId;
            tblVendorDb.OtherDisciplineName        = objectModel.OtherDisciplineName;
            tblVendorDb.MobileNumber               = objectModel.MobileNumber;
            tblVendorDb.CompanyBrief               = objectModel.CompanyBrief;
            tblVendorDb.TradeAndBusinessFile       = objectModel.TradeAndBusinessFile;
            tblVendorDb.ActualTradeAndBusinessFile = objectModel.ActualTradeAndBusinessFile;
            tblVendorDb.ImageFile                  = objectModel.ImageFile;
            tblVendorDb.ActualImageFile            = objectModel.ActualImageFile;
            tblVendorDb.AdminApproval              = objectModel.AdminApproval;
            tblVendorDb.Remark = objectModel.AdminApproval == 2 ? objectModel.Remark : "";

            if (objectModel.VendorId > 0)
            {
                // Table Vendor

                tblVendorDb.VendorId   = objectModel.VendorId;
                tblVendorDb.ModifiedBy = AdminSessionData.AdminUserId;
                tblVendorDb.ModifiedOn = DateTime.UtcNow;
                tblVendorDb.Status     = (byte)objectModel.Status;

                context.tblVendors.Attach(tblVendorDb);
                context.Entry(tblVendorDb).Property(x => x.VendorName).IsModified                 = true;
                context.Entry(tblVendorDb).Property(x => x.DisciplineId).IsModified               = true;
                context.Entry(tblVendorDb).Property(x => x.MobileNumber).IsModified               = true;
                context.Entry(tblVendorDb).Property(x => x.CompanyBrief).IsModified               = true;
                context.Entry(tblVendorDb).Property(x => x.TradeAndBusinessFile).IsModified       = true;
                context.Entry(tblVendorDb).Property(x => x.ActualTradeAndBusinessFile).IsModified = true;
                context.Entry(tblVendorDb).Property(x => x.ImageFile).IsModified       = true;
                context.Entry(tblVendorDb).Property(x => x.ActualImageFile).IsModified = true;
                context.Entry(tblVendorDb).Property(x => x.AdminApproval).IsModified   = true;
                context.Entry(tblVendorDb).Property(x => x.Remark).IsModified          = true;
                context.Entry(tblVendorDb).Property(x => x.ModifiedBy).IsModified      = true;
                context.Entry(tblVendorDb).Property(x => x.ModifiedOn).IsModified      = true;
                context.Entry(tblVendorDb).Property(x => x.Status).IsModified          = true;
                count = context.SaveChanges();
                if (count >= 0)
                {
                    count = objectModel.VendorId;
                }
                else
                {
                    count = -2;
                }
            }
            else
            {
                try
                {
                    tblVendorDb.CreatedBy     = AdminSessionData.AdminUserId;
                    tblVendorDb.CreatedOn     = DateTime.UtcNow;
                    tblVendorDb.CreatedFromIp = HttpContext.Current.Request.UserHostAddress;
                    context.tblVendors.Add(tblVendorDb);
                    context.SaveChanges();
                    long _vendorId = tblVendorDb.VendorId;
                    count = context.SaveChanges();
                    if (count >= 0)
                    {
                        count = _vendorId;
                    }
                    else
                    {
                        count = -2;   // any error is there
                    }
                }
                catch (Exception ex)
                {
                    new AppError().LogMe(ex);
                    count = -2;   // any error is there
                }
            }
            return(count);
        }
Example #23
0
        public long AddNewVendor(VendorModel objectModel, HttpPostedFileBase image, HttpPostedFileBase tradeFile)
        {
            long _vendorId = -2;

            if (!IsEmailExists(objectModel.EmailId))
            {
                if (image != null)
                {
                    Guid g = Guid.NewGuid();
                    objectModel.ActualImageFile = image.FileName;
                    objectModel.ImageFile       = g.ToString() + Path.GetExtension(image.FileName);
                }

                if (tradeFile != null)
                {
                    Guid g2 = Guid.NewGuid();
                    objectModel.ActualTradeAndBusinessFile = tradeFile.FileName;
                    objectModel.TradeAndBusinessFile       = g2.ToString() + Path.GetExtension(tradeFile.FileName);
                }
                tblVendor tblVendorDb = new tblVendor();
                tblVendorDb.VendorName                 = objectModel.VendorName;
                tblVendorDb.EmailId                    = objectModel.EmailId;
                tblVendorDb.DisciplineId               = objectModel.DisciplineId;
                tblVendorDb.OtherDisciplineName        = objectModel.OtherDisciplineName;
                tblVendorDb.MobileNumber               = objectModel.MobileNumber;
                tblVendorDb.CompanyBrief               = objectModel.CompanyBrief;
                tblVendorDb.TradeAndBusinessFile       = objectModel.TradeAndBusinessFile;
                tblVendorDb.ActualTradeAndBusinessFile = objectModel.ActualTradeAndBusinessFile;
                tblVendorDb.ImageFile                  = objectModel.ImageFile;
                tblVendorDb.ActualImageFile            = objectModel.ActualImageFile;
                tblVendorDb.AdminApproval              = 0;
                tblVendorDb.Status = 1;
                Encrypt64 enc = new Encrypt64();
                tblVendorDb.Password      = enc.Encrypt(AppLogic.GenerateRandomString(8));
                tblVendorDb.CreatedOn     = DateTime.UtcNow;
                tblVendorDb.CreatedFromIp = HttpContext.Current.Request.UserHostAddress;
                using (StratasFairDBEntities context = new StratasFairDBEntities())
                {
                    context.tblVendors.Add(tblVendorDb);
                    context.SaveChanges();
                }
                _vendorId = tblVendorDb.VendorId;
                try
                {
                    if (_vendorId > 0)
                    {
                        string path        = string.Empty;
                        int    fileMapped  = -1;
                        string initialPath = "resources/vendor/" + _vendorId;

                        if (image != null)
                        {
                            // Add/Delete the new trade and business file and image details
                            if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/Content/" + initialPath + "/ProfilePicture/")))
                            {
                                Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/Content/" + initialPath + "/ProfilePicture/"));
                            }
                            // save the file locally
                            path = HttpContext.Current.Server.MapPath(Path.Combine("~/Content/" + initialPath + "/ProfilePicture/" + objectModel.ImageFile));
                            image.SaveAs(path);

                            // save the file on s3
                            fileMapped = AwsS3Bucket.CreateFile(initialPath + "/ProfilePicture/" + objectModel.ImageFile, path);

                            // delete the file locally
                            if (System.IO.File.Exists(path))
                            {
                                System.IO.File.Delete(path);
                            }
                        }
                        if (tradeFile != null)
                        {
                            // Add/Delete the new trade and business file and image details
                            if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/Content/" + initialPath + "/TradeFile/")))
                            {
                                Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/Content/" + initialPath + "/TradeFile/"));
                            }
                            // save the file locally
                            path = HttpContext.Current.Server.MapPath(Path.Combine("~/Content/" + initialPath + "/TradeFile/" + objectModel.TradeAndBusinessFile));
                            tradeFile.SaveAs(path);

                            // save the file on s3
                            fileMapped = AwsS3Bucket.CreateFile(initialPath + "/TradeFile/" + objectModel.TradeAndBusinessFile, path);

                            //delete the file locally
                            if (System.IO.File.Exists(path))
                            {
                                System.IO.File.Delete(path);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    new AppError().LogMe(ex);
                    // any error is there
                }
                return(_vendorId);
            }
            else
            {
                return(-3);
            }
        }
        public ActionResult VenderRegistration(VenderRegistrationModel model)
        {
            try
            {
                tblVendor       tb  = new tblVendor();
                tblLedgerMaster tbl = new tblLedgerMaster();

                int Uname = getOutletId();

                if (model.VendorId > 0)
                {
                    tb = (from p in db.tblVendors where p.VendorId == model.VendorId select p).SingleOrDefault();
                }
                tb.Address          = model.Address;
                tb.ContactA         = model.ContactA;
                tb.ContactB         = model.ContactB;
                tb.Email            = model.Email;
                tb.Name             = model.Name;
                tb.OutletId         = 99;
                tb.RegistrationDate = DateTime.Now;
                tb.TinNo            = model.TinNo;

                tb.GSTin    = model.GSTin;
                tb.IfscCode = model.IfscCode;
                tb.Pan      = model.Pan;

                tb.ServiceTax    = (decimal)(model.ServiceTax == null ? 0 : model.ServiceTax);
                tb.AccountName   = model.AccountName;
                tb.AccountNumber = model.AccountNumber;
                tb.Bank          = model.Bank;
                tb.Branch        = model.Branch;
                tb.Paymentcycle  = model.Paymentcycle;

                tb.Active = model.Active;


                if (db.tblLedgerMasters.Select(p => p.RecordId).Count() > 0)
                {
                    tbl.RecordId = db.tblLedgerMasters.Select(p => p.RecordId).Max() + 1;
                }
                else
                {
                    tbl.RecordId = 1;
                }
                tbl.LedgerName  = model.Name;
                tbl.LedgerGroup = 3;
                tbl.Date        = DateTime.Now;

                if (model.VendorId > 0)
                {
                    db.SaveChanges();
                    TempData["Message"] = "Edit Successfully !";
                }
                else
                {
                    db.tblVendors.Add(tb);
                    db.SaveChanges();
                    tbl.VendorId = tb.VendorId;
                    db.tblLedgerMasters.Add(tbl);
                    db.SaveChanges();
                    TempData["Message"] = "Insert Successfully !";
                }
            }
            catch (Exception ex)
            {
                TempData["Message"] = ex.Message;
            }
            return(RedirectToAction("Vender"));
        }
Example #25
0
 public void Addvendors(tblVendor obj)
 {
     context.tblVendors.Add(obj);
 }
 partial void InserttblVendor(tblVendor instance);
 partial void UpdatetblVendor(tblVendor instance);
 partial void DeletetblVendor(tblVendor instance);