public ActionResult Edit([Bind(Include = "ManufacturerID,ManufacturerName")] ManufacturerInfo manufacturerInfo) { if (ModelState.IsValid) { db.Entry(manufacturerInfo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(manufacturerInfo)); }
void LoadShortInfo() { ManufacturerInfo e = ManufacturerInfo.GetShortInfoOf(manfname); lblCompayName.Text = e.manufacturName; lblCompanyContact.Text = e.contact; lblCompanyLoc.Text = e.address; lblCompanyWebsite.Text = e.website; lblCompayEmail.Text = e.email; }
protected void Page_Load(object sender, EventArgs e) { // Field validator error messages initialization rfvDisplayName.ErrorMessage = GetString("manufacturer_Edit.errorEmptyDisplayName"); string currentManufacturer = GetString("Manufacturer_Edit.NewItemCaption"); // Get manufacturer id from querystring manufacturerId = QueryHelper.GetInteger("manufacturerId", 0); editedSiteId = ConfiguredSiteID; if (manufacturerId > 0) { ManufacturerInfo manufacturerObj = EditedObject as ManufacturerInfo; if (manufacturerObj != null) { currentManufacturer = manufacturerObj.ManufacturerDisplayName; editedSiteId = manufacturerObj.ManufacturerSiteID; // Check edited object site ID CheckEditedObjectSiteID(editedSiteId); // Fill editing form if (!RequestHelper.IsPostBack()) { LoadData(manufacturerObj); // Show that the manufacturer was created or updated successfully if (ValidationHelper.GetString(Request.QueryString["saved"], "") == "1") { ShowChangesSaved(); } } } } // Init file uploader file.ObjectID = manufacturerId; file.ObjectType = ECommerceObjectType.MANUFACTURER; file.Category = MetaFileInfoProvider.OBJECT_CATEGORY_THUMBNAIL; file.SiteID = editedSiteId; // Initializes page title control string[,] breadcrumbs = new string[2, 3]; breadcrumbs[0, 0] = GetString("Manufacturer_Edit.ItemListLink"); breadcrumbs[0, 1] = "~/CMSModules/Ecommerce/Pages/Tools/Manufacturers/Manufacturer_List.aspx?siteId=" + SiteID; breadcrumbs[0, 2] = ""; breadcrumbs[1, 0] = FormatBreadcrumbObjectName(currentManufacturer, editedSiteId); breadcrumbs[1, 1] = ""; breadcrumbs[1, 2] = ""; CurrentMaster.Title.Breadcrumbs = breadcrumbs; AddMenuButtonSelectScript("Manufacturers", ""); }
public ActionResult Create([Bind(Include = "ManufacturerID,ManufacturerName")] ManufacturerInfo manufacturerInfo) { if (ModelState.IsValid) { db.ManufacturerInfo.Add(manufacturerInfo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(manufacturerInfo)); }
public int Insert(ManufacturerInfo oParam) { //string sql = " select top 1 sysno from Manufacturer where ManufacturerID = " + Util.ToSqlString(oParam.ManufacturerID); //DataSet ds = SqlHelper.ExecuteDataSet(sql); //if ( Util.HasMoreRow(ds) ) // throw new BizException("the same Manufacurer ID exists already"); oParam.SysNo = SequenceDac.GetInstance().Create("Manufacturer_Sequence"); oParam.ManufacturerID = oParam.SysNo.ToString(); return(new ManufacturerDac().Insert(oParam)); }
void LoadMedicineNames() { List <string> medicinenames = ManufacturerInfo.GetMedicineNameOf(manfname); foreach (string medicine in medicinenames) { MediListCardLongStrip nameStrip = new MediListCardLongStrip(medicine); nameStrip.ControlTheme = currentTheme; holderpanel.Children.Add(nameStrip); } }
public int Update(ManufacturerInfo oParam) { string sql = " select top 1 sysno from Manufacturer where ManufacturerID = " + Util.ToSqlString(oParam.ManufacturerID) + " and sysno <> " + oParam.SysNo; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) { throw new BizException("the same Manufacurer ID exists already"); } return(new ManufacturerDac().Update(oParam)); }
/// <summary> /// 转换品牌视图和品牌实体 /// </summary> /// <param name="data"></param> /// <returns></returns> private ManufacturerInfo CovertVMtoEntity(ManufacturerVM data) { ManufacturerInfo msg = data.ConvertVM <ManufacturerVM, ManufacturerInfo>((v, t) => { t.ManufacturerDescription = new LanguageContent(v.ManufacturerDescription); t.ManufacturerNameLocal = new LanguageContent(v.ManufacturerNameLocal);; }); msg.SysNo = data.SysNo; msg.SupportInfo = data.SupportInfo.ConvertVM <ManufacturerSupportVM, ManufacturerSupportInfo>(); return(msg); }
// GET: ManufacturerInfoes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ManufacturerInfo manufacturerInfo = db.ManufacturerInfo.Find(id); if (manufacturerInfo == null) { return(HttpNotFound()); } return(View(manufacturerInfo)); }
public byte[] Encode(BarcodeModel barcodeModel) { var consumableItems = ConvertBarcodeModelToConsumableItem(barcodeModel); if (consumableItems == null) { return(null); } ManufacturerInfo manufacturerInfo = manufacturerService.GetManufacturerInfo(1); var overallDataLayout = smartSenseSecure.Encode(manufacturerInfo.EncryptionScheme, consumableItems); return(overallDataLayout.ContinuousBlockBytes); }
/// <summary> /// Gets object from the specified column of the manufacturer with specific ID. /// </summary> /// <param name="Id">Manufacturer ID</param> /// <param name="column">Column name</param> public static object GetManufacturer(object Id, string column) { int id = ValidationHelper.GetInteger(Id, 0); if ((id > 0) && !DataHelper.IsEmpty(column)) { // Get manufacturer ManufacturerInfo mi = ManufacturerInfoProvider.GetManufacturerInfo(id); return(GetColumnValue(mi, column)); } return(""); }
private ManufacturerInfo LoadBySql(string sql) { DataSet ds = SqlHelper.ExecuteDataSet(sql); if (!Util.HasMoreRow(ds)) { return(null); } ManufacturerInfo oManuInfo = new ManufacturerInfo(); map(oManuInfo, ds.Tables[0].Rows[0]); return(oManuInfo); }
/// <summary> /// Sets data to database. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // Check module permissions bool global = (editedSiteId <= 0); if (!ECommerceContext.IsUserAuthorizedToModifyManufacturer(global)) { if (global) { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceGlobalModify"); } else { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyManufacturers"); } } // Check input values from textboxes and other controls - new Validator() string errorMessage = new Validator().NotEmpty(txtManufacturerDisplayName.Text.Trim(), GetString("manufacturer_Edit.errorEmptyDisplayName")).Result; if (errorMessage == "") { ManufacturerInfo manufacturerObj = ManufacturerInfoProvider.GetManufacturerInfo(manufacturerId); if (manufacturerObj == null) { manufacturerObj = new ManufacturerInfo(); // Assign site ID manufacturerObj.ManufacturerSiteID = ConfiguredSiteID; } manufacturerObj.ManufacturerID = manufacturerId; manufacturerObj.ManufacturerDisplayName = txtManufacturerDisplayName.Text.Trim(); manufacturerObj.ManufactureHomepage = txtManufactureHomepage.Text.Trim(); manufacturerObj.ManufacturerEnabled = chkManufacturerEnabled.Checked; // Save changes ManufacturerInfoProvider.SetManufacturerInfo(manufacturerObj); URLHelper.Redirect("Manufacturer_Edit.aspx?manufacturerId=" + Convert.ToString(manufacturerObj.ManufacturerID) + "&saved=1&siteId=" + SiteID.ToString()); } else { lblError.Visible = true; lblError.Text = errorMessage; } }
///// <summary> ///// 提交审核 ///// </summary> ///// <param name="info"></param> //public void InsertBrandRequest(BrandRequestInfo info) //{ // if (info.Manufacturer == null) // { // int sysno = ObjectFactory<IManufacturerDA>.Instance.IsExistManufacturerName(info.BrandNameLocal.Content,0); // if (sysno > 0) // { // info.Manufacturer = new ManufacturerProcessor().GetManufacturerInfoBySysNo(sysno); // } // else // { // ManufacturerInfo manufacturer = new ManufacturerInfo(); // manufacturer.ManufacturerNameLocal = info.BrandNameLocal; // manufacturer.ManufacturerNameGlobal = info.BrandNameGlobal; // manufacturer.Status = ManufacturerStatus.Active; // manufacturer.SupportInfo = new ManufacturerSupportInfo(); // info.Manufacturer = new ManufacturerProcessor().CreateManufacturer(manufacturer); // } // } // if (!brandRequestDA.IsExistsBrandRequest(info)) // { // if (!brandRequestDA.IsExistsBrandRequest_New(info)) // { // using (TransactionScope scope = new TransactionScope()) // { // brandRequestDA.InsertBrandRequest(info); // //提交审核之后发送消息 // EventPublisher.Publish<BrandAuditSubmitMessage>(new BrandAuditSubmitMessage() // { // SubmitUserSysNo = ServiceContext.Current.UserSysNo, // RequestSysNo = info != null ? info.SysNo : 0 // }); // scope.Complete(); // } // } // else // { // throw new BizException("该品牌已经被重复提交,请检查是否已存在或者正处于审核阶段!"); // } // } // else // { // throw new BizException(ResouceManager.GetMessageString("IM.Brand", "BrandAuditing")); // } //} /// <summary> /// 提交审核 /// </summary> /// <param name="info"></param> public void InsertBrandRequest(BrandRequestInfo info) { using (TransactionScope scope = new TransactionScope()) { if (info.Manufacturer == null) { int sysno = ObjectFactory <IManufacturerDA> .Instance.IsExistManufacturerName(info.BrandNameLocal.Content, 0); if (sysno > 0) { info.Manufacturer = new ManufacturerProcessor().GetManufacturerInfoBySysNo(sysno); } else { ManufacturerInfo manufacturer = new ManufacturerInfo(); manufacturer.ManufacturerNameLocal = info.BrandNameLocal; manufacturer.ManufacturerNameGlobal = info.BrandNameGlobal; manufacturer.Status = ManufacturerStatus.Active; manufacturer.SupportInfo = new ManufacturerSupportInfo(); info.Manufacturer = new ManufacturerProcessor().CreateManufacturer(manufacturer); } } if (!brandRequestDA.IsExistsBrandRequest(info)) { if (!brandRequestDA.IsExistsBrandRequest_New(info)) { brandRequestDA.InsertBrandRequest(info); //提交审核之后发送消息 EventPublisher.Publish <BrandAuditSubmitMessage>(new BrandAuditSubmitMessage() { SubmitUserSysNo = ServiceContext.Current.UserSysNo, RequestSysNo = info != null ? info.SysNo : 0 }); } else { throw new BizException("该品牌已经被重复提交,请检查是否已存在或者正处于审核阶段!"); } } else { throw new BizException(ResouceManager.GetMessageString("IM.Brand", "BrandAuditing")); } scope.Complete(); } }
private void RefreshCounters() { if (ct.Ping()) //Refresh all the counter { txtLogedInUser.Text = mySqlConnection.globalUser; Sicon.Fill = new SolidColorBrush(Color.FromRgb(20, 255, 30)); onlineStatus.Text = "Online"; UCMedi.text = MySqlMedicineEntry.MediCineCount().ToString(); UCStock.text = MySqlUtil.MediCineCount().ToString(); UCCompany.text = ManufacturerInfo.GetAllManufacturerName().Count.ToString(); } else { MessageBox.Show("Not Connected!"); } }
/// <summary> /// Sets data to database. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // Check module permissions bool global = (editedSiteId <= 0); if (!ECommerceContext.IsUserAuthorizedToModifyManufacturer(global)) { if (global) { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceGlobalModify"); } else { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyManufacturers"); } } // Check input values from textboxes and other controls - new Validator() string errorMessage = new Validator().NotEmpty(txtManufacturerDisplayName.Text.Trim(), GetString("manufacturer_Edit.errorEmptyDisplayName")).Result; if (errorMessage == "") { ManufacturerInfo manufacturerObj = ManufacturerInfoProvider.GetManufacturerInfo(manufacturerId); if (manufacturerObj == null) { manufacturerObj = new ManufacturerInfo(); // Assign site ID manufacturerObj.ManufacturerSiteID = ConfiguredSiteID; } manufacturerObj.ManufacturerID = manufacturerId; manufacturerObj.ManufacturerDisplayName = txtManufacturerDisplayName.Text.Trim(); manufacturerObj.ManufactureHomepage = txtManufactureHomepage.Text.Trim(); manufacturerObj.ManufacturerEnabled = chkManufacturerEnabled.Checked; // Save changes ManufacturerInfoProvider.SetManufacturerInfo(manufacturerObj); URLHelper.Redirect("Manufacturer_Edit.aspx?manufacturerId=" + Convert.ToString(manufacturerObj.ManufacturerID) + "&saved=1&siteId=" + SiteID.ToString()); } else { lblError.Visible = true; lblError.Text = errorMessage; } }
/// <summary> /// 更新生产商信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public virtual ManufacturerInfo UpdateManufacturer(ManufacturerInfo entity) { if (entity != null) { CheckManufacturerProcessor.CheckManufacturerSysNo(entity.SysNo); } CheckManufacturerProcessor.CheckManufacturerInfo(entity); using (TransactionScope scope = new TransactionScope()) { entity = _manufacturerDA.UpdateManufacturer(entity); if (entity.Status == ManufacturerStatus.DeActive) { ObjectFactory <IProductLineDA> .Instance.DeleteByManufacturer(entity.SysNo.Value); } scope.Complete(); } return(entity); }
public int Insert(ManufacturerInfo oParam) { string sql = @"INSERT INTO Manufacturer ( SysNo, ManufacturerID, ManufacturerName, BriefName, Note, Status ) VALUES ( @SysNo, @ManufacturerID, @ManufacturerName, @BriefName, @Note, @Status )"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramManufacturerID = new SqlParameter("@ManufacturerID", SqlDbType.NVarChar, 20); SqlParameter paramManufacturerName = new SqlParameter("@ManufacturerName", SqlDbType.NVarChar, 100); SqlParameter paramBriefName = new SqlParameter("@BriefName", SqlDbType.NVarChar, 50); SqlParameter paramNote = new SqlParameter("@Note", SqlDbType.NVarChar, 2000); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); paramSysNo.Value = oParam.SysNo; paramManufacturerID.Value = oParam.ManufacturerID; paramManufacturerName.Value = oParam.ManufacturerName; paramBriefName.Value = oParam.BriefName; if (oParam.Note != AppConst.StringNull) { paramNote.Value = oParam.Note; } else { paramNote.Value = System.DBNull.Value; } paramStatus.Value = oParam.Status; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramManufacturerID); cmd.Parameters.Add(paramManufacturerName); cmd.Parameters.Add(paramBriefName); cmd.Parameters.Add(paramNote); cmd.Parameters.Add(paramStatus); return(SqlHelper.ExecuteNonQuery(cmd)); }
void RegisterCompany(string manfName) { if (CheckAvailabilty()) { ManufacturerInfo manufacturer = new ManufacturerInfo(manfName, txtAdd.Text, contactsfrommini[0], emailsfrommini[0], txtWebsite.Text); bool registerSuccessfull = manufacturer.Register(); if (registerSuccessfull) { bool suc = manufacturer.RecordContactsAndEmails(contactsfrommini, emailsfrommini); if (suc) { MessageBox.Show("Saved"); CleanField(); listBxCompanies.Items.Add(manfName); } } } }
/// <summary> /// 修改厂商信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public virtual ManufacturerInfo UpdateManufacturer(ManufacturerInfo entity) { DataCommand cmd = DataCommandManager.GetDataCommand("UpdateManufacturer"); cmd.SetParameterValue("@SysNo", entity.SysNo); cmd.SetParameterValue("@ManufacturerID", entity.ManufacturerID); cmd.SetParameterValue("@ManufacturerName", entity.ManufacturerNameLocal.Content); cmd.SetParameterValue("@BriefName", entity.ManufacturerNameGlobal); cmd.SetParameterValue("@Note", entity.ManufacturerDescription != null ? entity.ManufacturerDescription.Content : null); cmd.SetParameterValue("@Status", entity.Status); cmd.SetParameterValue("@ManufacturerWebSite", entity.SupportInfo.ManufacturerUrl); cmd.SetParameterValue("@SupportEmail", entity.SupportInfo.ServiceEmail); cmd.SetParameterValue("@SupportURL", entity.SupportInfo.ServiceUrl); cmd.SetParameterValue("@Type", entity.BrandStoreType); cmd.SetParameterValue("@CustomerServicePhone", entity.SupportInfo.ServicePhone); cmd.SetParameterValue("@IsLogo", entity.IsLogo); cmd.SetParameterValue("@IsShowZone", entity.IsShowZone); cmd.SetParameterValue("@AdImage", entity.BrandImage); cmd.SetParameterValue("@NeweggUrl", entity.ShowUrl); cmd.ExecuteNonQuery(); return(entity); }
/// <summary> /// 创建厂商信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public virtual ManufacturerInfo CreateManufacturer(ManufacturerInfo entity) { DataCommand cmd = DataCommandManager.GetDataCommand("CreateManufacturer"); cmd.SetParameterValue("@ManufacturerName", entity.ManufacturerNameLocal != null ? entity.ManufacturerNameLocal.Content : null); cmd.SetParameterValue("@BriefName", entity.ManufacturerNameGlobal); cmd.SetParameterValue("@Note", entity.ManufacturerDescription != null ? entity.ManufacturerDescription.Content : null); cmd.SetParameterValue("@Status", entity.Status); cmd.SetParameterValue("@ManufacturerWebSite", entity.SupportInfo.ManufacturerUrl); cmd.SetParameterValue("@SupportEmail", entity.SupportInfo.ServiceEmail); cmd.SetParameterValue("@SupportURL", entity.SupportInfo.ServiceUrl); cmd.SetParameterValue("@Type", 0); cmd.SetParameterValue("@CustomerServicePhone", entity.SupportInfo.ServicePhone); cmd.SetParameterValue("@CompanyCode", entity.CompanyCode); cmd.SetParameterValue("@LanguageCode", entity.LanguageCode); cmd.ExecuteNonQuery(); if (entity.SysNo == 0 || entity.SysNo == null) { entity.SysNo = (int)cmd.GetParameterValue("@SysNo"); } return(entity); }
/// <summary> /// 修改生产商 /// </summary> /// <param name="data"></param> /// <param name="callback"></param> public void UpdateManufacturer(ManufacturerRequestVM data, EventHandler <RestClientEventArgs <ManufacturerInfo> > callback) { ManufacturerInfo info = new ManufacturerInfo() { ManufacturerDescription = new LanguageContent(data.Info), ManufacturerNameGlobal = data.ManufacturerBriefName, ManufacturerNameLocal = new LanguageContent(data.ManufacturerName), IsShowZone = data.IsShowZone == true ? "Y" : "N", IsLogo = data.IsLogo, BrandImage = data.BrandImage, BrandStoreType = data.BrandStoreType, ShowUrl = data.ShowUrl, Status = data.ManufacturerStatus, SysNo = data.SysNo, SupportInfo = new ManufacturerSupportInfo() { ManufacturerUrl = data.MannfacturerLink, ServiceEmail = data.AfterSalesSupportEmail, ServicePhone = data.ClientPhone, ServiceUrl = data.AfterSalesSupportLink }, }; restClient.Update(UPManufacturerUrl, info, callback); }
/// <summary> /// Handles the UniGrid's OnAction event. /// </summary> /// <param name="actionName">Name of item (button) that throws event</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void uniGrid_OnAction(string actionName, object actionArgument) { int manufacturerId = ValidationHelper.GetInteger(actionArgument, 0); if (actionName == "edit") { URLHelper.Redirect("Manufacturer_Edit.aspx?manufacturerId=" + manufacturerId + "&siteId=" + SelectSite.SiteID); } else if (actionName == "delete") { // Check module permissions ManufacturerInfo manufacturerObj = ManufacturerInfoProvider.GetManufacturerInfo(manufacturerId); if (!ECommerceContext.IsUserAuthorizedToModifyManufacturer(manufacturerObj)) { if (manufacturerObj.IsGlobal) { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceGlobalModify"); } else { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyManufacturers"); } } // Check dependencies if (ManufacturerInfoProvider.CheckDependencies(manufacturerId)) { // Show error message ShowError(GetString("Ecommerce.DeleteDisabled")); return; } // Delete ManufacturerInfo object from database ManufacturerInfoProvider.DeleteManufacturerInfo(manufacturerObj); InitWhereCondition(); } }
/// <summary> /// Gets object from the specified column of the manufacturer with specific ID. /// </summary> /// <param name="Id">Manufacturer ID</param> /// <param name="column">Column name</param> public static object GetManufacturer(object Id, string column) { int id = ValidationHelper.GetInteger(Id, 0); if ((id > 0) && !DataHelper.IsEmpty(column)) { // Get manufacturer ManufacturerInfo mi = ManufacturerInfoProvider.GetManufacturerInfo(id); if (mi != null) { // Return datarow value if specified column exists if (mi.ContainsColumn(column)) { return(mi.GetValue(column)); } else { return(""); } } } return(""); }
/// <summary> /// Returns where condition based on webpart fields. /// </summary> private string GetWhereCondition() { string where = "SKUSiteID = " + SiteContext.CurrentSiteID; // Show products only from current site or global too, based on setting if (ECommerceSettings.AllowGlobalProducts(SiteContext.CurrentSiteName)) { where = "(SKUSiteID = " + SiteContext.CurrentSiteID + ") OR (SKUSiteID IS NULL)"; } // Show/hide product variants - it is based on type of inventory tracking for parent product string trackByVariants = TrackInventoryTypeEnum.ByVariants.ToStringRepresentation(); string parentSkuWhere = "(SKUParentSKUID IS NULL) AND (SKUTrackInventory != '" + trackByVariants + "')"; string variantWhere = GetParentProductWhereCondition("SKUTrackInventory = '" + trackByVariants + "'"); where = SqlHelper.AddWhereCondition(where, string.Format("({0}) OR ({1})", parentSkuWhere, variantWhere)); // Product type filter if (!string.IsNullOrEmpty(ProductType) && (ProductType != FILTER_ALL)) { if (ProductType == PRODUCT_TYPE_PRODUCTS) { where = SqlHelper.AddWhereCondition(where, "SKUOptionCategoryID IS NULL"); } else if (ProductType == PRODUCT_TYPE_PRODUCT_OPTIONS) { where = SqlHelper.AddWhereCondition(where, "SKUOptionCategoryID IS NOT NULL"); } } // Representing filter if (!string.IsNullOrEmpty(Representing) && (Representing != FILTER_ALL)) { SKUProductTypeEnum productTypeEnum = Representing.ToEnum <SKUProductTypeEnum>(); string productTypeString = productTypeEnum.ToStringRepresentation(); where = SqlHelper.AddWhereCondition(where, "SKUProductType = N'" + productTypeString + "'"); } // Product number filter if (!string.IsNullOrEmpty(ProductNumber)) { string safeProductNumber = SqlHelper.GetSafeQueryString(ProductNumber, true); where = SqlHelper.AddWhereCondition(where, "SKUNumber LIKE N'%" + safeProductNumber + "%'"); } // Department filter DepartmentInfo di = DepartmentInfoProvider.GetDepartmentInfo(Department, CurrentSiteName); di = di ?? DepartmentInfoProvider.GetDepartmentInfo(Department, null); if (di != null) { where = SqlHelper.AddWhereCondition(where, GetColumnWhereCondition("SKUDepartmentID", "SKUDepartmentID = " + di.DepartmentID)); } // Manufacturer filter ManufacturerInfo mi = ManufacturerInfoProvider.GetManufacturerInfo(Manufacturer, CurrentSiteName); mi = mi ?? ManufacturerInfoProvider.GetManufacturerInfo(Manufacturer, null); if (mi != null) { where = SqlHelper.AddWhereCondition(where, GetColumnWhereCondition("SKUManufacturerID", "SKUManufacturerID = " + mi.ManufacturerID)); } // Supplier filter SupplierInfo si = SupplierInfoProvider.GetSupplierInfo(Supplier, CurrentSiteName); si = si ?? SupplierInfoProvider.GetSupplierInfo(Supplier, null); if (si != null) { where = SqlHelper.AddWhereCondition(where, GetColumnWhereCondition("SKUSupplierID", "SKUSupplierID = " + si.SupplierID)); } // Needs shipping filter if (!string.IsNullOrEmpty(NeedsShipping) && (NeedsShipping != FILTER_ALL)) { if (NeedsShipping == NEEDS_SHIPPING_YES) { where = SqlHelper.AddWhereCondition(where, GetColumnWhereCondition("SKUNeedsShipping", "SKUNeedsShipping = 1")); } else if (NeedsShipping == NEEDS_SHIPPING_NO) { where = SqlHelper.AddWhereCondition(where, GetColumnWhereCondition("SKUNeedsShipping", "(SKUNeedsShipping = 0) OR (SKUNeedsShipping IS NULL)")); } } // Price from filter if (PriceFrom > 0) { where = SqlHelper.AddWhereCondition(where, "SKUPrice >= " + PriceFrom); } // Price to filter if (PriceTo > 0) { where = SqlHelper.AddWhereCondition(where, "SKUPrice <= " + PriceTo); } // Public status filter PublicStatusInfo psi = PublicStatusInfoProvider.GetPublicStatusInfo(PublicStatus, CurrentSiteName); if (psi != null) { where = SqlHelper.AddWhereCondition(where, GetColumnWhereCondition("SKUPublicStatusID", "SKUPublicStatusID = " + psi.PublicStatusID)); } // Internal status filter InternalStatusInfo isi = InternalStatusInfoProvider.GetInternalStatusInfo(InternalStatus, CurrentSiteName); if (isi != null) { where = SqlHelper.AddWhereCondition(where, GetColumnWhereCondition("SKUInternalStatusID", "SKUInternalStatusID = " + isi.InternalStatusID)); } // Allow for sale filter if (!string.IsNullOrEmpty(AllowForSale) && (AllowForSale != FILTER_ALL)) { if (AllowForSale == ALLOW_FOR_SALE_YES) { where = SqlHelper.AddWhereCondition(where, "SKUEnabled = 1"); } else if (AllowForSale == ALLOW_FOR_SALE_NO) { where = SqlHelper.AddWhereCondition(where, "(SKUEnabled = 0) OR (SKUEnabled IS NULL)"); } } // Available items filter if (!string.IsNullOrEmpty(AvailableItems)) { int value = ValidationHelper.GetInteger(AvailableItems, int.MaxValue); where = SqlHelper.AddWhereCondition(where, "SKUAvailableItems <= " + value); } // Needs to be reordered filter if (NeedsToBeReordered) { where = SqlHelper.AddWhereCondition(where, "((SKUReorderAt IS NULL) AND (SKUAvailableItems <= 0)) OR ((SKUReorderAt IS NOT NULL) AND (SKUAvailableItems <= SKUReorderAt))"); } return(where); }
/// <summary> /// Load data of editing manufacturer. /// </summary> /// <param name="manufacturerObj">Manufacturer object</param> protected void LoadData(ManufacturerInfo manufacturerObj) { txtManufacturerDisplayName.Text = manufacturerObj.ManufacturerDisplayName; txtManufacturerName.Text = manufacturerObj.ManufacturerName; txtDescription.Text = manufacturerObj.ManufacturerDescription; txtManufactureHomepage.Text = manufacturerObj.ManufacturerHomepage; chkManufacturerEnabled.Checked = manufacturerObj.ManufacturerEnabled; chkIsImportant.Checked = manufacturerObj.ManufacturerIsImportant; }
/// <summary> /// Sets data to database. /// </summary> protected void btnOK_Click(object sender, EventArgs e) { // Check module permissions bool global = (editedSiteId <= 0); if (!ECommerceContext.IsUserAuthorizedToModifyManufacturer(global)) { if (global) { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceGlobalModify"); } else { RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyManufacturers"); } } // Check input values from textboxes and other controls - new Validator() string errorMessage = new Validator(). NotEmpty(txtManufacturerDisplayName.Text.Trim(), GetString("manufacturer_Edit.errorEmptyDisplayName")). IsCodeName(txtManufacturerName.Text.Trim(), GetString("general.invalidcodename")).Result; if (errorMessage == "") { ManufacturerInfo manufacturerObj = null; // Manufacturer code name must be unique string siteWhere = (ConfiguredSiteID > 0) ? " AND (ManufacturerSiteID = " + ConfiguredSiteID + " OR ManufacturerSiteID IS NULL)" : ""; DataSet ds = ManufacturerInfoProvider.GetManufacturers("ManufacturerName = N'" + SqlHelperClass.GetSafeQueryString(txtManufacturerName.Text.Trim(), false) + "'" + siteWhere, null, 1, null); if (!DataHelper.DataSourceIsEmpty(ds)) { manufacturerObj = new ManufacturerInfo(ds.Tables[0].Rows[0]); } if ((manufacturerObj == null) || (manufacturerObj.ManufacturerID == manufacturerId)) { if (manufacturerObj == null) { manufacturerObj = ManufacturerInfoProvider.GetManufacturerInfo(manufacturerId); if (manufacturerObj == null) { // Create new manufacturer manufacturerObj = new ManufacturerInfo(); manufacturerObj.ManufacturerSiteID = ConfiguredSiteID; } } manufacturerObj.ManufacturerID = manufacturerId; manufacturerObj.ManufacturerDisplayName = txtManufacturerDisplayName.Text.Trim(); manufacturerObj.ManufacturerName = txtManufacturerName.Text.Trim(); manufacturerObj.ManufacturerDescription = txtDescription.Text.Trim(); manufacturerObj.ManufacturerHomepage = txtManufactureHomepage.Text.Trim(); manufacturerObj.ManufacturerEnabled = chkManufacturerEnabled.Checked; manufacturerObj.ManufacturerIsImportant = chkIsImportant.Checked; bool isNew = (manufacturerObj.ManufacturerID <= 0); // Save changes ManufacturerInfoProvider.SetManufacturerInfo(manufacturerObj); if (isNew) { file.ObjectID = manufacturerObj.ManufacturerID; file.UploadFile(); } URLHelper.Redirect("Manufacturer_Edit.aspx?manufacturerId=" + Convert.ToString(manufacturerObj.ManufacturerID) + "&saved=1&siteId=" + SiteID.ToString()); } else { // Show error message ShowError(GetString("com.manufacturernameexists")); } } else { // Show error message ShowError(errorMessage); } }
/// <summary> /// Returns where condition based on webpart fields. /// </summary> private string GetWhereCondition() { string where = null; // Show products only from current site or global too, based on setting if (ECommerceSettings.AllowGlobalProducts(CMSContext.CurrentSiteName)) { where = "(SKUSiteID = " + CMSContext.CurrentSiteID + ") OR (SKUSiteID IS NULL)"; } else { where = "SKUSiteID = " + CMSContext.CurrentSiteID; } // Product type filter if (!string.IsNullOrEmpty(ProductType) && (ProductType != FILTER_ALL)) { if (ProductType == PRODUCT_TYPE_PRODUCTS) { where = SqlHelperClass.AddWhereCondition(where, "SKUOptionCategoryID IS NULL"); } else if (ProductType == PRODUCT_TYPE_PRODUCT_OPTIONS) { where = SqlHelperClass.AddWhereCondition(where, "SKUOptionCategoryID IS NOT NULL"); } } // Representing filter if (!string.IsNullOrEmpty(Representing) && (Representing != FILTER_ALL)) { SKUProductTypeEnum productTypeEnum = SKUInfoProvider.GetSKUProductTypeEnum(Representing); string productTypeString = SKUInfoProvider.GetSKUProductTypeString(productTypeEnum); where = SqlHelperClass.AddWhereCondition(where, "SKUProductType = N'" + productTypeString + "'"); } // Product number filter if (!string.IsNullOrEmpty(ProductNumber)) { string safeProductNumber = SqlHelperClass.GetSafeQueryString(ProductNumber, true); where = SqlHelperClass.AddWhereCondition(where, "SKUNumber LIKE N'%" + safeProductNumber + "%'"); } // Department filter DepartmentInfo di = DepartmentInfoProvider.GetDepartmentInfo(Department, CurrentSiteName); if (di != null) { where = SqlHelperClass.AddWhereCondition(where, "SKUDepartmentID = " + di.DepartmentID); } // Manufacturer filter ManufacturerInfo mi = ManufacturerInfoProvider.GetManufacturerInfo(Manufacturer, CurrentSiteName); if (mi != null) { where = SqlHelperClass.AddWhereCondition(where, "SKUManufacturerID = " + mi.ManufacturerID); } // Supplier filter SupplierInfo si = SupplierInfoProvider.GetSupplierInfo(Supplier, CurrentSiteName); if (si != null) { where = SqlHelperClass.AddWhereCondition(where, "SKUSupplierID = " + si.SupplierID); } // Needs shipping filter if (!string.IsNullOrEmpty(NeedsShipping) && (NeedsShipping != FILTER_ALL)) { if (NeedsShipping == NEEDS_SHIPPING_YES) { where = SqlHelperClass.AddWhereCondition(where, "SKUNeedsShipping = 1"); } else if (NeedsShipping == NEEDS_SHIPPING_NO) { where = SqlHelperClass.AddWhereCondition(where, "(SKUNeedsShipping = 0) OR (SKUNeedsShipping IS NULL)"); } } // Price from filter if (PriceFrom > 0) { where = SqlHelperClass.AddWhereCondition(where, "SKUPrice >= " + PriceFrom); } // Price to filter if (PriceTo > 0) { where = SqlHelperClass.AddWhereCondition(where, "SKUPrice <= " + PriceTo); } // Public status filter PublicStatusInfo psi = PublicStatusInfoProvider.GetPublicStatusInfo(PublicStatus, CurrentSiteName); if (psi != null) { where = SqlHelperClass.AddWhereCondition(where, "SKUPublicStatusID = " + psi.PublicStatusID); } // Internal status filter InternalStatusInfo isi = InternalStatusInfoProvider.GetInternalStatusInfo(InternalStatus, CurrentSiteName); if (isi != null) { where = SqlHelperClass.AddWhereCondition(where, "SKUInternalStatusID = " + isi.InternalStatusID); } // Allow for sale filter if (!string.IsNullOrEmpty(AllowForSale) && (AllowForSale != FILTER_ALL)) { if (AllowForSale == ALLOW_FOR_SALE_YES) { where = SqlHelperClass.AddWhereCondition(where, "SKUEnabled = 1"); } else if (AllowForSale == ALLOW_FOR_SALE_NO) { where = SqlHelperClass.AddWhereCondition(where, "(SKUEnabled = 0) OR (SKUEnabled IS NULL)"); } } // Available items filter if (!string.IsNullOrEmpty(AvailableItems)) { int value = ValidationHelper.GetInteger(AvailableItems, int.MaxValue); where = SqlHelperClass.AddWhereCondition(where, "SKUAvailableItems <= " + value); } // Needs to be reordered filter if (NeedsToBeReordered) { where = SqlHelperClass.AddWhereCondition(where, "((SKUReorderAt IS NULL) AND (SKUAvailableItems <= 0)) OR ((SKUReorderAt IS NOT NULL) AND (SKUAvailableItems <= SKUReorderAt))"); } return(where); }
private object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { DataRowView row = parameter as DataRowView; switch (sourceName.ToLowerCSafe()) { case "optioncategory": int optionCategoryId = ValidationHelper.GetInteger(row["SKUOptionCategoryID"], 0); OptionCategoryInfo optionCategory = OptionCategoryInfoProvider.GetOptionCategoryInfo(optionCategoryId); // Return option category display name for product option or '-' for product if (optionCategory != null) { return(HTMLHelper.HTMLEncode(optionCategory.CategoryDisplayName ?? "")); } return("-"); case "skunumber": string skuNumber = ValidationHelper.GetString(row["SKUNumber"], null); return(HTMLHelper.HTMLEncode(skuNumber ?? "")); case "skuprice": double value = ValidationHelper.GetDouble(row["SKUPrice"], 0); int siteId = ValidationHelper.GetInteger(row["SKUSiteID"], 0); // Format price return(CurrencyInfoProvider.GetFormattedPrice(value, siteId)); case "skudepartmentid": // Tranform to display name and localize int departmentId = ValidationHelper.GetInteger(row["SKUDepartmentID"], 0); DepartmentInfo department = DepartmentInfoProvider.GetDepartmentInfo(departmentId); return((department != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(department.DepartmentDisplayName)) : ""); case "skumanufacturerid": // Tranform to display name and localize int manufacturerId = ValidationHelper.GetInteger(row["SKUManufacturerID"], 0); ManufacturerInfo manufacturer = ManufacturerInfoProvider.GetManufacturerInfo(manufacturerId); return((manufacturer != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(manufacturer.ManufacturerDisplayName)) : ""); case "skusupplierid": // Tranform to display name and localize int supplierId = ValidationHelper.GetInteger(row["SKUSupplierID"], 0); SupplierInfo supplier = SupplierInfoProvider.GetSupplierInfo(supplierId); return((supplier != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(supplier.SupplierDisplayName)) : ""); case "skuavailableitems": int?count = row["SKUAvailableItems"] as int?; int?reorderAt = row["SKUReorderAt"] as int?; // Emphasise the number when product needs to be reordered if (count.HasValue && ((reorderAt.HasValue && (count <= reorderAt)) || (!reorderAt.HasValue && (count <= 0)))) { // Format message informing about insufficient stock level string reorderMsg = string.Format(GetString("com.sku.reorderatTooltip"), reorderAt); return(string.Format("<span class=\"OperationFailed\">{0}</span>", count)); } return(count); case "itemstobereordered": int skuReorderAt = ValidationHelper.GetInteger(row["SKUReorderAt"], 0); int skuAvailableItems = ValidationHelper.GetInteger(row["SKUAvailableItems"], 0); int difference = skuReorderAt - skuAvailableItems; // Return difference, or '-' return((difference > 0) ? difference.ToString() : "-"); case "skusiteid": return(UniGridFunctions.ColoredSpanYesNo(row["SKUSiteID"] == DBNull.Value)); } return(parameter); }
/// <summary> /// Gets and bulk updates manufacturers. Called when the "Get and bulk update manufacturers" button is pressed. /// Expects the CreateManufacturer method to be run first. /// </summary> private bool GetAndBulkUpdateManufacturers() { // Prepare the parameters string where = "ManufacturerName LIKE N'MyNewManufacturer%'"; where = SqlHelperClass.AddWhereCondition(where, "ManufacturerSiteID = " + CMSContext.CurrentSiteID, "AND"); // Get the data DataSet manufacturers = ManufacturerInfoProvider.GetManufacturers(where, null); if (!DataHelper.DataSourceIsEmpty(manufacturers)) { // Loop through the individual items foreach (DataRow manufacturerDr in manufacturers.Tables[0].Rows) { // Create object from DataRow ManufacturerInfo modifyManufacturer = new ManufacturerInfo(manufacturerDr); // Update the properties modifyManufacturer.ManufacturerDisplayName = modifyManufacturer.ManufacturerDisplayName.ToUpper(); // Update the manufacturer ManufacturerInfoProvider.SetManufacturerInfo(modifyManufacturer); } return true; } return false; }
/// <summary> /// Creates manufacturer. Called when the "Create manufacturer" button is pressed. /// </summary> private bool CreateManufacturer() { // Create new manufacturer object ManufacturerInfo newManufacturer = new ManufacturerInfo(); // Set the properties newManufacturer.ManufacturerDisplayName = "My new manufacturer"; newManufacturer.ManufacturerName = "MyNewManufacturer"; newManufacturer.ManufacturerHomepage = "www.mynewmanufacturer.com"; newManufacturer.ManufacturerSiteID = CMSContext.CurrentSiteID; newManufacturer.ManufacturerEnabled = true; // Create the manufacturer ManufacturerInfoProvider.SetManufacturerInfo(newManufacturer); return true; }
/// <summary> /// 生产商审核 /// </summary> /// <param name="info"></param> public void AuditManufacturerRequest(ManufacturerRequestInfo info) { // bug 2832 //if (!manufacturerRequestDA.CheckManufacturerUser(info.SysNo)) //{ ManufacturerInfo manufacture;//创建或更改后的生产商 ManufacturerInfo manufacturrtInfo = new ManufacturerInfo() { Status = info.ManufacturerStatus, ManufacturerNameLocal = new LanguageContent() { Content = info.ManufacturerName }, ManufacturerDescription = new LanguageContent() { Content = info.Reasons }, ManufacturerNameGlobal = info.ManufacturerBriefName, SupportInfo = new ManufacturerSupportInfo(), ManufacturerID = info.ManufacturerSysNo.ToString(), SysNo = info.ManufacturerSysNo, LanguageCode = info.LanguageCode, CompanyCode = info.CompanyCode }; //CheckExistManufacturerName(info.ManufacturerBriefName, info.ManufacturerSysNo); using (TransactionScope scope = new TransactionScope()) //check 逻辑在创建和更新方法中 { if (info.Status == 1) { if (info.OperationType == 1) { //创建生产商 manufacture = manufacturerProcessor.CreateManufacturer(manufacturrtInfo); info.ManufacturerSysNo = manufacture.SysNo;//将创建后的生产商在更新回审核表 } if (info.OperationType == 2) { //修改生产商 manufacture = manufacturerProcessor.UpdateManufacturer(manufacturrtInfo); } } manufacturerRequestDA.AuditManufacturerRequest(info); //状态更新之后发送消息 switch (info.Status) { //审核通过 case 1: EventPublisher.Publish <ECCentral.Service.EventMessage.IM.ManufacturerAuditMessage>(new ECCentral.Service.EventMessage.IM.ManufacturerAuditMessage() { AuditUserSysNo = ServiceContext.Current.UserSysNo, RequestSysNo = info != null ? info.SysNo : 0, ManufacturerSysNo = info != null ? info.ManufacturerSysNo : 0 }); break; //审核拒绝 case -1: EventPublisher.Publish <ECCentral.Service.EventMessage.IM.ManufacturerRejectMessage>(new ECCentral.Service.EventMessage.IM.ManufacturerRejectMessage() { RejectUserSysNo = ServiceContext.Current.UserSysNo, RequestSysNo = info != null ? info.SysNo : 0, ManufacturerSysNo = info != null ? info.ManufacturerSysNo : 0 }); break; //审核取消 case -2: EventPublisher.Publish <ECCentral.Service.EventMessage.IM.ManufacturerCancelMessage>(new ECCentral.Service.EventMessage.IM.ManufacturerCancelMessage() { CancelUserSysNo = ServiceContext.Current.UserSysNo, RequestSysNo = info != null ? info.SysNo : 0, ManufacturerSysNo = info != null ? info.ManufacturerSysNo : 0 }); break; } scope.Complete(); } //} //else //{ // throw new BizException("审核人和创建人不能是同一个人!"); //} }
private object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter) { DataRowView rowView = parameter as DataRowView; if (rowView != null) { SKUInfo sku = new SKUInfo(rowView.Row); switch (sourceName.ToLowerCSafe()) { case "skuname": string fullName = sku.SKUName; // For variant, add name from parent SKU if (sku.SKUParentSKUID != 0) { SKUInfo parentSku = SKUInfoProvider.GetSKUInfo(sku.SKUParentSKUID); fullName = string.Format("{0}: {1}", parentSku.SKUName, sku.SKUName); } return(HTMLHelper.HTMLEncode(fullName)); case "optioncategory": OptionCategoryInfo optionCategory = OptionCategoryInfoProvider.GetOptionCategoryInfo(sku.SKUOptionCategoryID); // Return option category display name for product option or '-' for product if (optionCategory != null) { return(HTMLHelper.HTMLEncode(optionCategory.CategoryDisplayName ?? "")); } return("-"); case "skunumber": return(ResHelper.LocalizeString(sku.SKUNumber, null, true)); case "skuprice": // Format price return(CurrencyInfoProvider.GetFormattedPrice(sku.SKUPrice, sku.SKUSiteID)); case "skudepartmentid": // Transform to display name and localize DepartmentInfo department = DepartmentInfoProvider.GetDepartmentInfo(sku.SKUDepartmentID); return((department != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(department.DepartmentDisplayName)) : ""); case "skumanufacturerid": // Transform to display name and localize ManufacturerInfo manufacturer = ManufacturerInfoProvider.GetManufacturerInfo(sku.SKUManufacturerID); return((manufacturer != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(manufacturer.ManufacturerDisplayName)) : ""); case "skusupplierid": // Transform to display name and localize SupplierInfo supplier = SupplierInfoProvider.GetSupplierInfo(sku.SKUSupplierID); return((supplier != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(supplier.SupplierDisplayName)) : ""); case "skupublicstatusid": // Transform to display name and localize PublicStatusInfo publicStatus = PublicStatusInfoProvider.GetPublicStatusInfo(sku.SKUPublicStatusID); return((publicStatus != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(publicStatus.PublicStatusDisplayName)) : ""); case "skuinternalstatusid": // Transform to display name and localize InternalStatusInfo internalStatus = InternalStatusInfoProvider.GetInternalStatusInfo(sku.SKUInternalStatusID); return((internalStatus != null) ? HTMLHelper.HTMLEncode(ResHelper.LocalizeString(internalStatus.InternalStatusDisplayName)) : ""); case "skuavailableitems": int?count = sku.SKUAvailableItems as int?; int?reorderAt = sku.SKUReorderAt as int?; // Emphasize the number when product needs to be reordered if (count.HasValue && ((reorderAt.HasValue && (count <= reorderAt)) || (!reorderAt.HasValue && (count <= 0)))) { // Format message informing about insufficient stock level return(string.Format("<span class=\"OperationFailed\">{0}</span>", count)); } return(count); case "itemstobereordered": int difference = sku.SKUReorderAt - sku.SKUAvailableItems; // Return difference, or '-' return((difference > 0) ? difference.ToString() : "-"); case "skusiteid": return(UniGridFunctions.ColoredSpanYesNo(sku.SKUSiteID == 0)); } } return(parameter); }
/// <summary> /// Returns where condition based on webpart fields. /// </summary> private WhereCondition GetWhereCondition() { var where = new WhereCondition().WhereEquals("SKUSiteID", SiteContext.CurrentSiteID); // Show products only from current site or global too, based on setting if (ECommerceSettings.AllowGlobalProducts(SiteContext.CurrentSiteName)) { where.Where(w => w.WhereEquals("SKUSiteID", SiteContext.CurrentSiteID).Or().WhereNull("SKUSiteID")); } // Show/hide product variants - it is based on type of inventory tracking for parent product string trackByVariants = TrackInventoryTypeEnum.ByVariants.ToStringRepresentation(); where.Where(v => v.Where(w => w.WhereNull("SKUParentSKUID").And().WhereNotEquals("SKUTrackInventory", trackByVariants)) .Or() .Where(GetParentProductWhereCondition(new WhereCondition().WhereEquals("SKUTrackInventory", trackByVariants)))); // Product type filter if (!string.IsNullOrEmpty(ProductType) && (ProductType != FILTER_ALL)) { if (ProductType == PRODUCT_TYPE_PRODUCTS) { where.WhereNull("SKUOptionCategoryID"); } else if (ProductType == PRODUCT_TYPE_PRODUCT_OPTIONS) { where.WhereNotNull("SKUOptionCategoryID"); } } // Representing filter if (!string.IsNullOrEmpty(Representing) && (Representing != FILTER_ALL)) { SKUProductTypeEnum productTypeEnum = Representing.ToEnum <SKUProductTypeEnum>(); string productTypeString = productTypeEnum.ToStringRepresentation(); where.WhereEquals("SKUProductType", productTypeString); } // Product number filter if (!string.IsNullOrEmpty(ProductNumber)) { where.WhereContains("SKUNumber", ProductNumber); } // Department filter DepartmentInfo di = DepartmentInfoProvider.GetDepartmentInfo(Department, CurrentSiteName); di = di ?? DepartmentInfoProvider.GetDepartmentInfo(Department, null); if (di != null) { where.Where(GetColumnWhereCondition("SKUDepartmentID", new WhereCondition().WhereEquals("SKUDepartmentID", di.DepartmentID))); } // Manufacturer filter ManufacturerInfo mi = ManufacturerInfoProvider.GetManufacturerInfo(Manufacturer, CurrentSiteName); mi = mi ?? ManufacturerInfoProvider.GetManufacturerInfo(Manufacturer, null); if (mi != null) { where.Where(GetColumnWhereCondition("SKUManufacturerID", new WhereCondition().WhereEquals("SKUManufacturerID", mi.ManufacturerID))); } // Supplier filter SupplierInfo si = SupplierInfoProvider.GetSupplierInfo(Supplier, CurrentSiteName); si = si ?? SupplierInfoProvider.GetSupplierInfo(Supplier, null); if (si != null) { where.Where(GetColumnWhereCondition("SKUSupplierID", new WhereCondition().WhereEquals("SKUSupplierID", si.SupplierID))); } // Needs shipping filter if (!string.IsNullOrEmpty(NeedsShipping) && (NeedsShipping != FILTER_ALL)) { if (NeedsShipping == NEEDS_SHIPPING_YES) { where.Where(GetColumnWhereCondition("SKUNeedsShipping", new WhereCondition().WhereTrue("SKUNeedsShipping"))); } else if (NeedsShipping == NEEDS_SHIPPING_NO) { where.Where(GetColumnWhereCondition("SKUNeedsShipping", new WhereCondition().WhereFalse("SKUNeedsShipping").Or().WhereNull("SKUNeedsShipping"))); } } // Price from filter if (PriceFrom > 0) { where.WhereGreaterOrEquals("SKUPrice", PriceFrom); } // Price to filter if (PriceTo > 0) { where.WhereLessOrEquals("SKUPrice", PriceTo); } // Public status filter PublicStatusInfo psi = PublicStatusInfoProvider.GetPublicStatusInfo(PublicStatus, CurrentSiteName); if (psi != null) { where.Where(GetColumnWhereCondition("SKUPublicStatusID", new WhereCondition().WhereEquals("SKUPublicStatusID", psi.PublicStatusID))); } // Internal status filter InternalStatusInfo isi = InternalStatusInfoProvider.GetInternalStatusInfo(InternalStatus, CurrentSiteName); if (isi != null) { where.Where(GetColumnWhereCondition("SKUInternalStatusID", new WhereCondition().WhereEquals("SKUInternalStatusID", isi.InternalStatusID))); } // Allow for sale filter if (!string.IsNullOrEmpty(AllowForSale) && (AllowForSale != FILTER_ALL)) { if (AllowForSale == ALLOW_FOR_SALE_YES) { where.WhereTrue("SKUEnabled"); } else if (AllowForSale == ALLOW_FOR_SALE_NO) { where.WhereEqualsOrNull("SKUEnabled", false); } } // Available items filter if (!string.IsNullOrEmpty(AvailableItems)) { int value = ValidationHelper.GetInteger(AvailableItems, int.MaxValue); where.WhereLessOrEquals("SKUAvailableItems", value); } // Needs to be reordered filter if (NeedsToBeReordered) { where.Where(w => w.Where(v => v.WhereNull("SKUReorderAt").And().WhereLessOrEquals("SKUAvailableItems", 0)) .Or() .Where(z => z.WhereNotNull("SKUReorderAt").And().WhereLessOrEquals("SKUAvailableItems".AsColumn(), "SKUReorderAt".AsColumn()))); } return(where); }
/// <summary> /// Load data of editing manufacturer. /// </summary> /// <param name="manufacturerObj">Manufacturer object</param> protected void LoadData(ManufacturerInfo manufacturerObj) { txtManufacturerDisplayName.Text = manufacturerObj.ManufacturerDisplayName; txtManufactureHomepage.Text = manufacturerObj.ManufactureHomepage; chkManufacturerEnabled.Checked = manufacturerObj.ManufacturerEnabled; }
public ManufacturerInfo CreateManufacturer(ManufacturerInfo request) { var entity = ObjectFactory <ManufacturerAppService> .Instance.CreateManufacturer(request); return(entity); }