// GET: MyClients
        public ActionResult Index()
        {
            logger.Info("Simplex Invoice MyClients. Index()");

            if (!User.Identity.IsAuthenticated)
            {
                return RedirectToAction("Login", "Account");
            }

            ClientCompany c = null;

            if (c == null)
            {
                c = new ClientCompany();
                c.CompanyName = string.Empty;
                c.ContactPerson = string.Empty;
                c.AddressLine1 = string.Empty;
                c.AddressLine2 = string.Empty;
                c.City = string.Empty;
                c.State = "NY";
                c.Zip = string.Empty;
                c.Email = string.Empty;
                c.MobileNumber = string.Empty;
                c.OfficeNumber = string.Empty;
                c.FaxNumber = string.Empty;
            }

            lc = lch.GetCompanyRegisteredByUser(User.Identity.Name);
            if(lc != null)
            {
                c.WeightRate = lc.WeightRate;
                c.ComplimentaryWeight = lc.ComplimentaryWeight;
                c.BasePickupCharge = lc.BasePickupCharge;
            }


            ViewData["PU_FORM"] = c;

            return View();
        }
Ejemplo n.º 2
0
        public int Delete(ClientCompany c)
        {
            using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                conn.Open();
                int result = conn.Execute(@"
                    delete invoice.[MyClients]
                    where CompanyId = @CompanyId
                                            ", c);

                return result;
            }
        }
Ejemplo n.º 3
0
        public int Update(ClientCompany c)
        {
            using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                conn.Open();
                int result = conn.Execute(@"
                    update invoice.[MyClients]
                    set CompanyName = @CompanyName
                        ,ContactPerson = @ContactPerson
                        ,AddressLine1 = @AddressLine1
                        ,AddressLine2 = @AddressLine2
                        ,City = @City
                        ,State = @State
                        ,Zip = @Zip
                        ,Email = @Email
                        ,MobileNumber = @MobileNumber
                        ,OfficeNumber = @OfficeNumber
                        ,FaxNumber = @FaxNumber
                        ,BillToName = @BillToName
                        ,BillToAddressLine1 = @BillToAddressLine1
                        ,BillToAddressLine2 = @BillToAddressLine2
                        ,BillToCity = @BillToCity
                        ,BillToState = @BillToState
                        ,BillToZip = @BillToZip
                        ,ComplimentaryWeight = @ComplimentaryWeight
                        ,BasePickupCharge = @BasePickupCharge
                        ,WeightRate = @WeightRate
                        ,ModifiedBy = @ModifiedBy
                        ,ModifiedAt = getdate()
                    where ClientCompanyId = @ClientCompanyId
                                            ", c);

                return result;
            }
        }
Ejemplo n.º 4
0
        public int Add(ClientCompany c)
        {


            using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                conn.Open();
                var result = conn.Query<int>(@"
                    insert into invoice.[MyClients](CompanyId,CompanyName,ContactPerson,
	                                            AddressLine1,AddressLine2,City,State,Zip,Email,
	                                            MobileNumber,OfficeNumber,FaxNumber,ComplimentaryWeight,WeightRate,
                                                BillToName,BillToAddressLine1,BillToAddressLine2,BillToCity,BillToState,BillToZip,
	                                            BasePickupCharge,CreatedBy,CreatedAt)
                                           values(@CompanyId,@CompanyName,@ContactPerson,
	                                            @AddressLine1,@AddressLine2,@City,@State,@Zip,@Email,
	                                            @MobileNumber,@OfficeNumber,@FaxNumber,@ComplimentaryWeight,@WeightRate,
                                                @BillToName,@BillToAddressLine1,@BillToAddressLine2,@BillToCity,@BillToState,@BillToZip,
	                                            @BasePickupCharge,@CreatedBy,getdate());
                   SELECT SCOPE_IDENTITY()

                   
                                            ", c);

                return result.FirstOrDefault();
            }
        }
        public ActionResult Editing_Destroy([DataSourceRequest] DataSourceRequest request, ClientCompany company)
        {
            string destinationFilePath = System.Web.HttpContext.Current.Server.MapPath("~/Content/products");

            try
            {
                //string fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.OriginalImageId);
                //FileInfo fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }
                //}
                //fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.SmallImageId);
                //fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }
                //}
                //fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.MediumImageId);
                //fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }
                //}
                //fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.LargeImageId);
                //fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }
                //}
                //fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.ImageIdOne);
                //fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }

                //}
                //fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.ImageIdTwo);
                //fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }
                //}
                //fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.ImageIdThree);
                //fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }
                //}
                //fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.ImageIdFour);
                //fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }
                //}
                //fileToDelete = string.Format(@"{0}\{1}", destinationFilePath, product.ImageIdFive);
                //fi = new FileInfo(fileToDelete);
                //if (fi.Exists)
                //{
                //    try
                //    {
                //        fi.Delete();
                //    }
                //    catch { }
                //}



            }
            catch (Exception ex)
            {
                logger.Fatal(ex);
            }


            //productHandler.DeleteProduct(product);

            return Json(new[] { company }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, ClientCompany company)
        {
            //productHandler.UpdateProduct(product);

            return Json(new[] { company }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult Editing_Create([DataSourceRequest] DataSourceRequest request, ClientCompany company)
        {

            //var addedProduct = productHandler.AddProduct(product);
            //if (addedProduct != null)
            //{
            //    ViewBag.Message = "Record saved";
            //    ViewBag.ErrorFound = false;

            //    product.ProductID = addedProduct.ProductID;
            //}
            //else
            //{
            //    ViewBag.Message = "Failed to save record";
            //    ViewBag.ErrorFound = true;

            //}


            return Json(new[] { company }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult GetClientInfo([DataSourceRequest]DataSourceRequest request, string clientCompanyString)
        {

            
            string message = "Getting company";
            if (lc == null)
                lc = lch.GetCompanyRegisteredByUser(User.Identity.Name);

            ClientCompany c = cch.GetClientCompanyByName(clientCompanyString,lc); 

            if (c == null)
            {
                c = new ClientCompany();
                c.CompanyName = clientCompanyString;
                c.ContactPerson = string.Empty;
                c.AddressLine1 = string.Empty;
                c.AddressLine2 = string.Empty;
                c.City = string.Empty;
                c.State = "NY";
                c.Zip = string.Empty;
                c.Email = string.Empty;
                c.MobileNumber = string.Empty;
                c.OfficeNumber = string.Empty;
                c.FaxNumber = string.Empty;
                c.WeightRate = 3;
                c.ComplimentaryWeight = 1000;
                c.BasePickupCharge = 56;

            }





            return Json(new { success = true, message = c }, JsonRequestBehavior.AllowGet);
        }