示例#1
0
        public async System.Threading.Tasks.Task <ActionResult> UpdateColorMaster(ColorMaster _color)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            try
            {
                ColorMaster master = new ColorMaster();
                master.Id            = _color.Id;
                master.ModifiedBy    = currentuser.Id;
                master.ModifiedDate  = DateTime.Now;
                master.Name          = _color.Name;
                master.Description   = _color.Description;
                master.StoreId       = currentuser.StoreId;
                master.workstation   = Commonhelper.GetStation();
                master.FinancialYear = DateTime.Now.Year;
                master.CompanyId     = currentuser.CompanyId;
                try
                {
                    Commonhelper.Updatecolor(master);
                    return(RedirectToAction("ColorMaster"));
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("ColorMaster"));
                }
            }
            catch (Exception ex)
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Error in category creation!');</script>"));
            }
        }
示例#2
0
        public async System.Threading.Tasks.Task <ActionResult> UpdateBrandMaster([DataSourceRequest] DataSourceRequest request, BrandMaster _brand)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();
            BrandMaster   master      = new BrandMaster();

            try
            {
                master.Id            = _brand.Id;
                master.ModifiedBy    = currentuser.Id;
                master.ModifiedDate  = DateTime.Now;
                master.Name          = _brand.Name;
                master.CheckName     = _brand.Name;
                master.Description   = _brand.Description;
                master.StoreId       = currentuser.StoreId;
                master.workstation   = Commonhelper.GetStation();
                master.FinancialYear = DateTime.Now.Year;
                master.CompanyId     = currentuser.CompanyId;
                try
                {
                    Commonhelper.UpdateBrand(master);
                    return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
                }
                catch (Exception ex)
                {
                    return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
                }
            }
            catch (Exception ex)
            {
                return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
            }
        }
示例#3
0
        public async System.Threading.Tasks.Task <ActionResult> CreateBrandMaster(BrandMaster _brand)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            if (ModelState.IsValid)
            {
                try
                {
                    BrandMaster master = new BrandMaster();
                    master.Id            = Guid.NewGuid().ToString();
                    master.CreatedBy     = currentuser.Id;
                    master.CreatedDate   = DateTime.Now;
                    master.Name          = _brand.Name;
                    master.Description   = _brand.Description;
                    master.StoreId       = currentuser.StoreId;
                    master.workstation   = Commonhelper.GetStation();
                    master.FinancialYear = DateTime.Now.Year;
                    master.CompanyId     = currentuser.CompanyId;
                    master.Isactive      = true;
                    try
                    {
                        Commonhelper.SaveBrand(master);
                        return(RedirectToAction("BrandMaster"));
                    }
                    catch (Exception ex)
                    {
                        return(RedirectToAction("BrandMaster"));
                    }
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("BrandMaster"));
                }
            }
            else
            {
            }

            return(Json(res));

            return(View());
        }
示例#4
0
        public ActionResult CreateCategory(CategoryMaster category)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            if (ModelState.IsValid)
            {
                try
                {
                    CategoryMaster master = new CategoryMaster();
                    master.Id            = Guid.NewGuid().ToString();
                    master.CreatedBy     = currentuser.Id;
                    master.CreatedDate   = DateTime.Now;
                    master.Name          = category.Name;
                    master.Discount      = category.Discount;
                    master.StoreId       = currentuser.StoreId;
                    master.workstation   = Commonhelper.GetStation();
                    master.FinancialYear = DateTime.Now.Year;
                    master.CompanyId     = currentuser.CompanyId;
                    master.Isactive      = true;
                    try
                    {
                        Commonhelper.SaveCategory(master);
                        return(RedirectToAction("Category"));
                    }
                    catch (Exception ex)
                    {
                        return(RedirectToAction("Category"));
                    }
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("Category"));
                }
            }
            else
            {
            }

            return(RedirectToAction("Category"));
        }
示例#5
0
        public ActionResult UpdateSubcategory([DataSourceRequest] DataSourceRequest request, SubCategoryMaster subcategory)
        {
            List <string>     res         = new List <string>();
            var               currentuser = Commonhelper.GetCurrentUserDetails();
            SubCategoryMaster master      = new SubCategoryMaster();

            try
            {
                master.Id            = subcategory.Id;
                master.ModifiedBy    = currentuser.Id;
                master.ModifiedDate  = DateTime.Now;
                master.Name          = subcategory.Name;
                master.CheckName     = subcategory.Name;
                master.CategoryName  = Commonhelper.GetCategoryName(subcategory.CategoryId);
                master.CategoryId    = subcategory.CategoryId;
                master.Description   = subcategory.Description;
                master.StoreId       = currentuser.StoreId;
                master.workstation   = Commonhelper.GetStation();
                master.FinancialYear = DateTime.Now.Year;
                master.CompanyId     = currentuser.CompanyId;
                try
                {
                    Commonhelper.UpdateSubCategory(master);
                    return(Json(new[] { master }.ToDataSourceResult(request)));
                    /// return RedirectToActionPermanent("SubCategory_Read");
                    ///  return RedirectToAction("Subcategory");
                }
                catch (Exception ex)
                {
                    return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
                }
            }
            catch (Exception ex)
            {
                return(Json(new[] { master }.ToDataSourceResult(request, ModelState)));
            }
        }
示例#6
0
        public ActionResult UpdateCategory(CategoryMaster category)
        {
            List <string> res         = new List <string>();
            var           currentuser = Commonhelper.GetCurrentUserDetails();

            try
            {
                CategoryMaster master = new CategoryMaster();
                master.Id            = category.Id;
                master.ModifiedBy    = currentuser.Id;
                master.ModifiedDate  = DateTime.Now;
                master.Name          = category.Name;
                master.Discount      = category.Discount;
                master.Description   = category.Description;
                master.StoreId       = currentuser.StoreId;
                master.workstation   = Commonhelper.GetStation();
                master.FinancialYear = DateTime.Now.Year;
                master.CompanyId     = currentuser.CompanyId;
                try
                {
                    Commonhelper.UpdateCategory(master);
                    return(Content("<script language='javascript' type='text/javascript'>alert('Category Created successfully!');</script>"));
                }
                catch (Exception ex)
                {
                    return(Content("<script language='javascript' type='text/javascript'>alert('Error in category creation!');</script>"));
                }
            }
            catch (Exception ex)
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Error in category creation!');</script>"));
            }



            return(Json(res));
        }
示例#7
0
        public ActionResult CreateItem(ItemMaster item)
        {
            List <string> res         = new List <string>();
            ItemMaster    _ItemMaster = new ItemMaster();

            try
            {
                if (ModelState.IsValid)
                {
                    var currentuser = Commonhelper.GetCurrentUserDetails();
                    _ItemMaster.StoreId     = currentuser.StoreId;
                    _ItemMaster.CompanyId   = currentuser.CompanyId;
                    _ItemMaster.Description = item.Description;
                    _ItemMaster.ProductCode = item.ProductCode;
                    _ItemMaster.BarCode     = item.BarCode;
                    _ItemMaster.SkuCode     = item.SkuCode;
                    _ItemMaster.SapCode     = item.SapCode;
                    _ItemMaster.Category    = item.Category;
                    _ItemMaster.Color       = item.Color;
                    _ItemMaster.SubCategory = item.SubCategory;

                    _ItemMaster.ProductName  = item.ProductName;
                    _ItemMaster.Brand        = item.Brand;
                    _ItemMaster.Size         = item.Size;
                    _ItemMaster.Quality      = item.Quality;
                    _ItemMaster.Gst          = item.Gst;
                    _ItemMaster.Reorderlevel = item.Reorderlevel;
                    _ItemMaster.Mrp          = item.Mrp;

                    _ItemMaster.Costprice       = item.Costprice;
                    _ItemMaster.Sellprice       = item.Sellprice;
                    _ItemMaster.offer           = item.offer;
                    _ItemMaster.FinancialYear   = item.FinancialYear;
                    _ItemMaster.workstation     = Commonhelper.GetStation();
                    _ItemMaster.HsnCode         = item.HsnCode;
                    _ItemMaster.MaximumQuantity = item.MaximumQuantity;


                    _ItemMaster.MinimumQuantity = item.MinimumQuantity;
                    _ItemMaster.BoxQuantity     = item.BoxQuantity;
                    _ItemMaster.IsUnique        = item.IsUnique;
                    _ItemMaster.Mou             = item.Mou;
                    _ItemMaster.SubMou          = item.SubMou;
                    _ItemMaster.ItemOrder       = item.ItemOrder;
                    _ItemMaster.CreatedDate     = DateTime.Now;
                    _ItemMaster.CreatedBy       = currentuser.Id;
                    _ItemMaster.Isactive        = true;
                    if (item.ItemOptionalDetails.Count() > 0)
                    {
                        foreach (var _item in item.ItemOptionalDetails)
                        {
                            ItemOptionalDetails option = new ItemOptionalDetails();
                            option.Id            = Guid.NewGuid().ToString();
                            option.ItemId        = _ItemMaster.Id;
                            option.OptionalId    = _item.OptionalId;
                            option.OptionalValue = _item.OptionalValue;
                            _ItemMaster.ItemOptionalDetails.Add(option);
                        }
                    }
                    Commonhelper.SaveItem(_ItemMaster);
                    return(Content("<script language='javascript' type='text/javascript'>alert('Item Created successfully!');</script>"));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
示例#8
0
        public async System.Threading.Tasks.Task <ActionResult> UpdateItem(ItemMaster item)
        {
            ItemMaster _ItemMaster = new ItemMaster();
            bool       status      = false;
            string     msg         = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var currentuser = Commonhelper.GetCurrentUserDetails();
                    _ItemMaster.Id          = item.Id;
                    _ItemMaster.StoreId     = currentuser.StoreId;
                    _ItemMaster.CompanyId   = currentuser.CompanyId;
                    _ItemMaster.Description = item.Description;
                    _ItemMaster.ProductCode = item.ProductCode;
                    _ItemMaster.BarCode     = item.BarCode;
                    _ItemMaster.SkuCode     = item.SkuCode;
                    _ItemMaster.SapCode     = item.SapCode;
                    _ItemMaster.Category    = item.Category;
                    _ItemMaster.Color       = item.Color;
                    _ItemMaster.SubCategory = item.SubCategory;

                    _ItemMaster.ProductName  = item.ProductName;
                    _ItemMaster.Brand        = item.Brand;
                    _ItemMaster.Size         = item.Size;
                    _ItemMaster.Quality      = item.Quality;
                    _ItemMaster.Gst          = item.Gst;
                    _ItemMaster.Reorderlevel = item.Reorderlevel;
                    _ItemMaster.Mrp          = item.Mrp;

                    _ItemMaster.Costprice       = item.Costprice;
                    _ItemMaster.Sellprice       = item.Sellprice;
                    _ItemMaster.offer           = item.offer;
                    _ItemMaster.FinancialYear   = item.FinancialYear;
                    _ItemMaster.workstation     = Commonhelper.GetStation();
                    _ItemMaster.HsnCode         = item.HsnCode;
                    _ItemMaster.MaximumQuantity = item.MaximumQuantity;


                    _ItemMaster.MinimumQuantity = item.MinimumQuantity;
                    _ItemMaster.BoxQuantity     = item.BoxQuantity;
                    _ItemMaster.IsUnique        = item.IsUnique;
                    _ItemMaster.Mou             = item.Mou;
                    _ItemMaster.SubMou          = item.SubMou;
                    _ItemMaster.ItemOrder       = item.ItemOrder;
                    _ItemMaster.ModifiedDate    = DateTime.Now;
                    _ItemMaster.ModifiedBy      = currentuser.Id;
                    if (item.ItemOptionalDetails.Count() > 0)
                    {
                        foreach (var _item in item.ItemOptionalDetails)
                        {
                            ItemOptionalDetails option = new ItemOptionalDetails();
                            option.Id            = Guid.NewGuid().ToString();
                            option.ItemId        = _ItemMaster.Id;
                            option.OptionalId    = _item.OptionalId;
                            option.OptionalValue = _item.OptionalValue;
                            _ItemMaster.ItemOptionalDetails.Add(option);
                        }
                    }
                    try
                    {
                        Commonhelper.UpdateItem(_ItemMaster);
                        status = true;
                        msg    = "Item Updated successfully!";
                        return(Json(new{ status, msg }, JsonRequestBehavior.AllowGet));
                    }
                    catch (Exception ex)
                    {
                        msg    = "Error in processing";
                        status = false;
                        return(Json(new { status, msg }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
            }
            return(View());
        }