void btnSaveOtherLanguage_Click(object sender, EventArgs e)
        {
            if (ViewState[CMSViewStateManager.SupplierID] != null && ucPortalLanguage.SelectedLanguageID > 0)
            {
                try
                {
                    // Update Info Except Language Info :

                    Supplier Supplier =
                        SupplierManager.GetSupplier(Convert.ToInt32(ViewState[CMSViewStateManager.SupplierID]),CMSContext.PortalID, CMSContext.LanguageID);

                    if (Supplier != null)
                    {
                        Supplier.IsEnabled = cbIsEnabled.Checked;

                        List<string> files = ucSWFUpload.GetFilesName();
                        if (files.Count > 0)
                            Supplier.LogoImage = files[0];
                        else
                            Supplier.LogoImage = string.Empty;

                        int parentSupplierId = -1;
                        int.TryParse(ddlParentSupplier.SelectedValue, out parentSupplierId);
                        if (parentSupplierId > 0)
                            Supplier.ParentSupplierID = parentSupplierId;

                        SupplierManager.Update(Supplier);

                        //SaveLanguage Info Only :
                        Supplier langSupplier = new Supplier
                        {
                            ID = Convert.ToInt32(ViewState[CMSViewStateManager.SupplierID]),
                            Name = txtName.Text,
                            Description = txtDescription.Text,
                            MetaTitle = txtMetaTitle.Text,
                            MetaDescription = txtMetaDescription.Text,
                            MetaKeywords = txtMetaKeywords.Text,
                            LanguageID = ucPortalLanguage.SelectedLanguageID,
                            ModuleID = (int)CMSEnums.ECommerceModule.Supplier,
                        };

                        SupplierManager.AddOtherLanguage(langSupplier);
                        BeginAddMode();
                        FillSupplierTree();
                        upnlSupplier.Update();
                        upnlSupplierItem.Update();
                    }
                }
                catch (Exception ex)
                {
                    dvProblems.Visible = true;
                    dvProblems.InnerText = ex.ToString();
                    upnlSupplier.Update();
                }
            }
        }
Пример #2
0
 public static int Add(Supplier supplier)
 {
     return SupplierDataMapper.Add(supplier);
 }
Пример #3
0
 public static void AddOtherLanguage(Supplier AddOtherLanguage)
 {
     SupplierDataMapper.AddOtherLanguage(AddOtherLanguage);
 }
Пример #4
0
 public static void Update(Supplier supplier)
 {
     SupplierDataMapper.Update(supplier);
 }
        private TreeNode GetNodesChilds(Supplier Supplier, List<Supplier> Suppliers)
        {
            TreeNode oNode;
            oNode = new TreeNode(Supplier.ID + ": " + Supplier.Name, Convert.ToString(Supplier.ID));
            //oNode.ImageUrl = GetPublishImage(menu.ID);

            if (ViewState[CMSViewStateManager.SupplierID] != null)
            {
                int SupplierSelected = Convert.ToInt32(ViewState[CMSViewStateManager.SupplierID]);
                if (SupplierSelected > 0 && oNode.Value == SupplierSelected.ToString())
                {
                    oNode.Selected = true;
                }
            }

            List<Supplier> SupplierChilds = Suppliers.Where(m => m.ParentSupplierID == Supplier.ID).ToList();
            if (SupplierChilds.Count > 0)
            {
                foreach (AJH.CMS.Core.Entities.Supplier SupplierChild in SupplierChilds)
                {
                    oNode.ChildNodes.Add(GetNodesChilds(SupplierChild, Suppliers));
                }
            }
            return oNode;
        }
        void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Supplier supplier = new Supplier();
                supplier.IsDeleted = false;
                supplier.LanguageID = CMSContext.LanguageID;
                supplier.PortalID = CMSContext.PortalID;

                supplier.Name = txtName.Text;
                supplier.Description = txtDescription.Text;
                supplier.IsEnabled = cbIsEnabled.Checked;

                int parentSupplierId = -1;
                int.TryParse(ddlParentSupplier.SelectedValue, out parentSupplierId);
                if (parentSupplierId > 0)
                    supplier.ParentSupplierID = parentSupplierId;

                List<string> files = ucSWFUpload.GetFilesName();
                if (files.Count > 0)
                    supplier.LogoImage = files[0];
                else
                    supplier.LogoImage = string.Empty;

                supplier.MetaTitle = txtMetaTitle.Text;
                supplier.MetaDescription = txtMetaDescription.Text;
                supplier.MetaKeywords = txtMetaKeywords.Text;

                supplier.ModuleID = (int)CMSEnums.ECommerceModule.Supplier;
                SupplierManager.Add(supplier);

                BeginAddMode();

                FillSupplierTree();
                upnlSupplier.Update();
            }
            catch (Exception ex)
            {
                dvProblems.Visible = true;
                dvProblems.InnerText = ex.ToString();
                upnlSupplier.Update();
            }
        }
Пример #7
0
        internal static void FillFromReader(Supplier Supplier, SqlDataReader reader)
        {
            int colIndex = 0;
            colIndex = reader.GetOrdinal(CN_SUPPLIER_ID);
            if (!reader.IsDBNull(colIndex))
                Supplier.ID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_SUPPLIER_LOGO_IMAGE);
            if (!reader.IsDBNull(colIndex))
                Supplier.LogoImage = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_SUPPLIER_IS_ENABLED);
            if (!reader.IsDBNull(colIndex))
                Supplier.IsEnabled = reader.GetBoolean(colIndex);

            colIndex = reader.GetOrdinal(CN_SUPPLIER_PARENT_OBJ_ID);
            if (!reader.IsDBNull(colIndex))
                Supplier.ParentSupplierID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_SUPPLIER_IS_DELETED);
            if (!reader.IsDBNull(colIndex))
                Supplier.IsDeleted = reader.GetBoolean(colIndex);

            colIndex = reader.GetOrdinal(CN_SUPPLIER_PORTAL_ID);
            if (!reader.IsDBNull(colIndex))
                Supplier.PortalID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_NAME);
            if (!reader.IsDBNull(colIndex))
                Supplier.Name = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_LAN_ID);
            if (!reader.IsDBNull(colIndex))
                Supplier.LanguageID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_DESC);
            if (!reader.IsDBNull(colIndex))
                Supplier.Description = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_NAME2);
            if (!reader.IsDBNull(colIndex))
                Supplier.MetaTitle = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_DESC2);
            if (!reader.IsDBNull(colIndex))
                Supplier.MetaDescription = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_KEYWORD);
            if (!reader.IsDBNull(colIndex))
                Supplier.MetaKeywords = reader.GetString(colIndex);
        }
Пример #8
0
        internal static Supplier GetSupplier(List<Supplier> Suppliers, SqlDataReader reader)
        {
            int colIndex = 0;
            colIndex = reader.GetOrdinal(CN_SUPPLIER_ID);
            int value = reader.GetInt32(colIndex);

            Supplier Supplier = Suppliers.Where(c => c.ID == value).FirstOrDefault();
            if (Supplier == null)
            {
                Supplier = new Supplier();
                Suppliers.Add(Supplier);
            }
            return Supplier;
        }