public ActionResult DeleteCategory(int NidCategory) { dbTransfer = new DbTransfer(); //check for brands and type and product if (dbTransfer.CheckForBrandByNidcategory(NidCategory) || dbTransfer.CheckForTypeByNidcategory(NidCategory) || dbTransfer.CheckForProductByNidcategory(NidCategory)) { return(Json(new JsonResults() { HasValue = false, Message = "حذف امکان پذیر نمی باشد.دسته بندی دارای محصول یا برند یا نوع می باشد" })); } else { dbTransfer.Delete(dbTransfer.GetCategoryByNidCategory(NidCategory)); if (dbTransfer.Save()) { return(Json(new JsonResults() { HasValue = true, Message = "دسته بندی با موفقیت حذف گردید" })); } else { return(Json(new JsonResults() { HasValue = false, Message = "خطا در حذف" })); } } }
public ActionResult DeleteBrand(Guid NidBrand) { dbTransfer = new DbTransfer(); //check for product if (dbTransfer.CheckForProductByNidBrand(NidBrand)) { return(Json(new JsonResults() { HasValue = false, Message = "این برند دارای محصول می باشد" })); } else { dbTransfer.Delete(dbTransfer.GetCategoryBrandByNidBrand(NidBrand)); if (dbTransfer.Save()) { return(Json(new JsonResults() { HasValue = true, Message = "برند با موفقیت حذف گردید" })); } else { return(Json(new JsonResults() { HasValue = false, Message = "خطا در حذف" })); } } }
public ActionResult GetEditCategory(int NidCategory) { dbTransfer = new DbTransfer(); Category category = dbTransfer.GetCategoryByNidCategory(NidCategory); List <Tuple <string, string, bool> > typelabels = new List <Tuple <string, string, bool> >(); List <Tuple <string, string, bool> > brandlabels = new List <Tuple <string, string, bool> >(); foreach (var lbl in category.Category_Types) { typelabels.Add(new Tuple <string, string, bool>(lbl.NidType.ToString(), lbl.TypeName, false)); } foreach (var lbl in category.Category_Brands) { brandlabels.Add(new Tuple <string, string, bool>(lbl.NidBrand.ToString(), lbl.BrandName, true)); } string types = RenderViewToString(this.ControllerContext, "_CategoryBrandAndTypeLabel", typelabels); string brands = RenderViewToString(this.ControllerContext, "_CategoryBrandAndTypeLabel", brandlabels); string pics = ""; if (category.Pictures != null) { pics = RenderViewToString(this.ControllerContext, "_UploadedImages", category.Pictures.Split(',').ToList()); } TempData["NidEditcategory"] = category.NidCategory; return(Json(new JsonCategoryEdit() { CategoryName = category.CategoryName, Description = category.Description, Keywords = category.keywords, NidCategory = category.NidCategory, BrandWrap = brands, TypeWrap = types, PicturesWrap = pics, Pictures = category.Pictures })); }
//users public ActionResult Users() { dbTransfer = new DbTransfer(); var userList = dbTransfer.GetAllUsers(100); return(View("Users", userList)); }
public ActionResult DeleteProduct(Guid NidProduct) { dbTransfer = new DbTransfer(); //check for orders if (dbTransfer.CheckForOrderByNidProduct(NidProduct)) { return(Json(new JsonResults() { HasValue = false, Message = "این محصول دارای سفارش می باشد" })); } else { dbTransfer.Delete(dbTransfer.GetProductByProductId(NidProduct)); if (dbTransfer.Save()) { return(Json(new JsonResults() { HasValue = true, Message = "محصول با موفقیت حذف گردید" })); } else { return(Json(new JsonResults() { HasValue = false, Message = "خطا در حذف" })); } } }
//category section public ActionResult Categories() { dbTransfer = new DbTransfer(); var categoryList = dbTransfer.GetAllCategories(100); return(View("Categories", categoryList)); }
// GET: Home public ActionResult Index() { dbTransfer = new DbTransfer(); List <Setting> sets = dbTransfer.GetAllSettings(); return(View(sets)); }
public ActionResult SyncBnTTable(bool IsBrand, int NidCategory) { CategoryAndBrandViewModel cbvm = new CategoryAndBrandViewModel(); if (NidCategory != -1) { dbTransfer = new DbTransfer(); if (IsBrand) { cbvm.category_Brand = dbTransfer.GetCategoryByNidCategory(NidCategory).Category_Brands.ToList(); cbvm.IsBrand = true; } else { cbvm.category_Type = dbTransfer.GetCategoryByNidCategory(NidCategory).Category_Types.ToList(); cbvm.IsBrand = false; } } else { cbvm.IsBrand = true; } return(Json(new JsonResults() { HasValue = true, Html = RenderViewToString(this.ControllerContext, "_BnTTable", cbvm) })); }
//products public ActionResult Products() { dbTransfer = new DbTransfer(); var prods = dbTransfer.GetAllProducts(100); return(View(prods)); }
//orders public ActionResult Orders() { dbTransfer = new DbTransfer(); var orders = dbTransfer.GetAllOrders(1000); return(View(orders)); }
public ActionResult AddUser(string Username, string Password, string Name = "", string LastName = "") { dbTransfer = new DbTransfer(); if (!dbTransfer.CheckForUserExistance(Username.Trim())) { dbTransfer.Add(new User() { NidUser = Guid.NewGuid(), CreateDate = DateTime.Now, Enabled = true, FirstName = Name, LastName = LastName, IsAdmin = true, Password = DbTransfer.Encrypt(Password), Username = Username }); if (dbTransfer.Save()) { return(Json(new JsonResults() { HasValue = true, Message = "کاربر با موفقیت ایجاد شد" })); } else { return(Json(new JsonResults() { HasValue = false, Message = "خطا در دیتابیس" })); } } else { return(Json(new JsonResults() { HasValue = false, Message = "این نام کاربری موجود می باشد" })); } }
public ActionResult ManageTypeAndBrand(bool IsBrand) { int NidCategory = int.Parse(TempData["NidEditcategory"].ToString()); dbTransfer = new DbTransfer(); CategoryAndBrandViewModel cbvm = new CategoryAndBrandViewModel(); if (NidCategory != -1) { Category category = dbTransfer.GetCategoryByNidCategory(NidCategory); if (IsBrand) { cbvm.category_Brand = category.Category_Brands.ToList(); cbvm.IsBrand = true; } else { cbvm.category_Type = category.Category_Types.ToList(); cbvm.IsBrand = false; } cbvm.NidCategory = category.NidCategory; cbvm.CategoryName = category.CategoryName; } return(View(cbvm)); }
public ActionResult AcceptedComments() { dbTransfer = new DbTransfer(); var comments = dbTransfer.GetAllComments(100, true); TempData["Comments"] = "1"; return(View("Comments", comments)); }
//comments public ActionResult Comments() { dbTransfer = new DbTransfer(); var comments = dbTransfer.GetAllComments(100); TempData["Comments"] = "0"; return(View(comments)); }
public ActionResult AddProduct() { ProductViewModel pvm = new ProductViewModel(); dbTransfer = new DbTransfer(); pvm.Categories = dbTransfer.GetAllCategories(100); return(View(pvm)); }
//ships public ActionResult Ships() { dbTransfer = new DbTransfer(); ShipsViewModel svm = new ShipsViewModel(); svm.Doing = dbTransfer.GetAllDoingShips(100); svm.Done = dbTransfer.GetAllDoneShips(100); return(View(svm)); }
public ActionResult CategoryDetail(int NidCategory) { dbTransfer = new DbTransfer(); Category category = dbTransfer.GetCategoryByNidCategory(NidCategory); return(Json(new JsonResults() { HasValue = true, Html = RenderViewToString(this.ControllerContext, "_CategoryDetail", category) })); }
public ActionResult EditBrand(Guid NidBrand) { dbTransfer = new DbTransfer(); Category_Brands brand = dbTransfer.GetCategoryBrandByNidBrand(NidBrand); return(Json(new JsonBnTEdit() { Description = brand.Description, Keywords = brand.Keywords, Name = brand.BrandName, Nid = brand.NidBrand.ToString() })); }
public ActionResult ShipDetail(Guid NidShip) { dbTransfer = new DbTransfer(); Ship ship = dbTransfer.GetShipByNidShip(NidShip); return(Json(new JsonResults() { HasValue = true, Html = RenderViewToString(this.ControllerContext, "_ShipDetail", ship) })); }
public ActionResult OrderDetail(Guid NidOrder) { dbTransfer = new DbTransfer(); Order order = dbTransfer.GetOrderByNidOrder(NidOrder); return(Json(new JsonResults() { HasValue = true, Html = RenderViewToString(this.ControllerContext, "_OrderDetail", order) })); }
public ActionResult EditType(Guid NidType) { dbTransfer = new DbTransfer(); Category_Types type = dbTransfer.GetCategoryTypeByNidType(NidType); return(Json(new JsonBnTEdit() { Description = type.Description, Keywords = type.Keywords, Name = type.TypeName, Nid = type.NidType.ToString() })); }
public ActionResult SyncUserTable() { dbTransfer = new DbTransfer(); var userlist = dbTransfer.GetAllUsers(100); return(Json(new JsonResults() { HasValue = true, Html = RenderViewToString(this.ControllerContext, "_UserTable", userlist) })); }
public ActionResult SyncCategoryTable() { dbTransfer = new DbTransfer(); var categoryList = dbTransfer.GetAllCategories(100); return(Json(new JsonResults() { HasValue = true, Html = RenderViewToString(this.ControllerContext, "_CategoryTable", categoryList) })); }
public ActionResult EditProduct(Guid NidProduct) { ProductViewModel pvm = new ProductViewModel(); dbTransfer = new DbTransfer(); Product product = dbTransfer.GetProductByProductId(NidProduct); pvm.Categories = dbTransfer.GetAllCategories(); pvm.Category_Brands = dbTransfer.GetCategoryBrandsByNidCategory(product.NidCategory); pvm.category_Types = dbTransfer.GetCategoryTypesByNidCategory(product.NidCategory); pvm.Product = product; //pvm.ProductDescription = product.Description.Replace("\"", "\\\""); return(View(pvm)); }
//settings public ActionResult UpdateSetting(int SettingIndex, string SettingValue) { dbTransfer = new DbTransfer(); Setting setting = null; //1:specialBanner,2:popularBanner switch (SettingIndex) { case 1: setting = new Setting() { NidSetting = Guid.NewGuid(), SettingAttribute = "specialBanner", SettingValue = SettingValue }; break; case 2: setting = new Setting() { NidSetting = Guid.NewGuid(), SettingAttribute = "popularBanner", SettingValue = SettingValue }; break; } if (setting != null) { dbTransfer.Add(setting); if (dbTransfer.Save()) { return(Json(new JsonResults() { HasValue = true, Message = "تنظیمات با موفقیت ثبت شد" })); } else { return(Json(new JsonResults() { HasValue = false, Message = "خطا در دیتابیس" })); } } else { return(Json(new JsonResults() { HasValue = false, Message = "تنظیمات ناشناخته" })); } }
public static TransferRule MakeTransferRule() { TransferRule aMockRule = new TransferRule(); aMockRule.RuleName = "新建数据迁移策略"; DbTransfer dt = new DbTransfer(); dt.DbName = _RestoreDbName; TableTransfer tt = new TableTransfer(); tt.TableName = _MainTableName; dt.AddTransferTable(tt); aMockRule.DbsToTransfer.Add(dt); return(aMockRule); }
public ActionResult SubmitEditProduct(ProductViewModel pvm) { dbTransfer = new DbTransfer(); pvm.Product.LastModified = DateTime.Now; dbTransfer.Update(pvm.Product); if (dbTransfer.Save()) { TempData["SucessfullAddProduct"] = "محصول با موفقیت ویرایش گردید"; return(RedirectToAction("Products")); } else { TempData["ErrorEditProduct"] = "خطا در دیتابیس"; return(RedirectToAction("EditProduct", new { NidProduct = pvm.Product.NidProduct })); } }
public ActionResult ManageType(bool IsNewType, string Name, int NidCategory, string Description = "", string Keywords = "", string NidType = "") { dbTransfer = new DbTransfer(); if (IsNewType) { Category_Types cb = new Category_Types() { TypeName = Name, NidType = Guid.NewGuid(), Description = Description, Keywords = Keywords, NidCategory = NidCategory }; dbTransfer.Add(cb); if (dbTransfer.Save()) { return(Json(new JsonResults() { HasValue = true })); } else { return(Json(new JsonResults() { HasValue = false, Message = "خطا در دیتابیس" })); } } else { Category_Types cb = dbTransfer.GetCategoryTypeByNidType(Guid.Parse(NidType)); cb.TypeName = Name; cb.Description = Description; cb.Keywords = Keywords; dbTransfer.Update(cb); if (dbTransfer.Save()) { return(Json(new JsonResults() { HasValue = true })); } else { return(Json(new JsonResults() { HasValue = false, Message = "خطا در دیتابیس" })); } } }
public ActionResult SubmitAddProduct(ProductViewModel pvm) { pvm.Product.CreateDate = DateTime.Now; pvm.Product.NidProduct = Guid.NewGuid(); dbTransfer = new DbTransfer(); dbTransfer.Add(pvm.Product); if (dbTransfer.Save()) { TempData["SucessfullAddProduct"] = "محصول با موفقیت اضافه شد"; return(RedirectToAction("Products")); } else { TempData["ErrorAddProduct"] = "خطا در دیتابیس"; return(RedirectToAction("AddProduct")); } }
public ActionResult SyncShipsTable(bool IsShipDone) { dbTransfer = new DbTransfer(); ShipsViewModel svm = new ShipsViewModel(); if (IsShipDone) { svm.Done = dbTransfer.GetAllDoneShips(100); } else { svm.Doing = dbTransfer.GetAllDoingShips(100); } svm.IsDone = IsShipDone; return(Json(new JsonResults() { HasValue = true, Html = RenderViewToString(this.ControllerContext, "_ShipTable", svm) })); }