void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Manufacturar Manufacturar = new Manufacturar();
                Manufacturar.IsDeleted = false;
                Manufacturar.LanguageID = CMSContext.LanguageID;
                Manufacturar.PortalID = CMSContext.PortalID;

                Manufacturar.Description = txtDescription.Text;
                Manufacturar.ShortDescription = txtShortDescription.Text;
                Manufacturar.IsEnabled = cbIsEnabled.Checked;

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

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

                Manufacturar.ModuleID = (int)CMSEnums.ECommerceModule.Manufacturar;
                ManufacturarManager.Add(Manufacturar);

                BeginAddMode();

                FillManufacturars(-1);
                upnlManufacturar.Update();
            }
            catch (Exception ex)
            {
                dvProblems.Visible = true;
                dvProblems.InnerText = ex.ToString();
                upnlManufacturar.Update();
            }
        }
        void btnSaveOtherLanguage_Click(object sender, EventArgs e)
        {
            if (ViewState[CMSViewStateManager.ManufacturarID] != null && ucPortalLanguage.SelectedLanguageID > 0)
            {
                try
                {
                    // Update Info Except Language Info :
                    Manufacturar Manufacturar =
                        ManufacturarManager.GetManufacturar(Convert.ToInt32(ViewState[CMSViewStateManager.ManufacturarID]), CMSContext.PortalID, CMSContext.LanguageID);

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

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

                        ManufacturarManager.Update(Manufacturar);

                        //SaveLanguage Info Only :
                        Manufacturar langManufacturar = new Manufacturar
                        {
                            ID = Convert.ToInt32(ViewState[CMSViewStateManager.ManufacturarID]),
                            Description = txtDescription.Text,
                            ShortDescription = txtShortDescription.Text,
                            MetaTitle = txtMetaTitle.Text,
                            MetaDescription = txtMetaDescription.Text,
                            MetaKeywords = txtMetaKeywords.Text,
                            LanguageID = ucPortalLanguage.SelectedLanguageID,
                            ModuleID = (int)CMSEnums.ECommerceModule.Manufacturar,
                        };

                        ManufacturarManager.AddOtherLanguage(langManufacturar);
                        BeginAddMode();
                        FillManufacturars(-1);
                        upnlManufacturar.Update();
                        upnlManufacturarItem.Update();
                    }
                }
                catch (Exception ex)
                {
                    dvProblems.Visible = true;
                    dvProblems.InnerText = ex.ToString();
                    upnlManufacturar.Update();
                }
            }
        }
Ejemplo n.º 3
0
 public static int Add(Manufacturar manufacturar)
 {
     return ManufacturarDataMapper.Add(manufacturar);
 }
Ejemplo n.º 4
0
 public static void AddOtherLanguage(Manufacturar manufacturar)
 {
     ManufacturarDataMapper.AddOtherLanguage(manufacturar);
 }
Ejemplo n.º 5
0
 public static void Update(Manufacturar manufacturar)
 {
     ManufacturarDataMapper.Update(manufacturar);
 }
        internal static void FillFromReader(Manufacturar manufacturar, SqlDataReader reader)
        {
            int colIndex = 0;
            colIndex = reader.GetOrdinal(CN_MANUFACTURARE_ID);
            if (!reader.IsDBNull(colIndex))
                manufacturar.ID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_MANUFACTURARE_LOGO_IMAGE);
            if (!reader.IsDBNull(colIndex))
                manufacturar.Image = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_MANUFACTURARE_IS_ENABLED);
            if (!reader.IsDBNull(colIndex))
                manufacturar.IsEnabled = reader.GetBoolean(colIndex);

            colIndex = reader.GetOrdinal(CN_MANUFACTURARE_IS_DELETED);
            if (!reader.IsDBNull(colIndex))
                manufacturar.IsDeleted = reader.GetBoolean(colIndex);

            colIndex = reader.GetOrdinal(CN_MANUFACTURARE_PORTAL_ID);
            if (!reader.IsDBNull(colIndex))
                manufacturar.PortalID = reader.GetInt32(colIndex);

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

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

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_DESC2);
            if (!reader.IsDBNull(colIndex))
                manufacturar.ShortDescription = reader.GetString(colIndex);

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

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_DETAILS);
            if (!reader.IsDBNull(colIndex))
                manufacturar.MetaDescription = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(ECommerceDataMapperBase.CN_ECO_LAN_KEYWORD);
            if (!reader.IsDBNull(colIndex))
                manufacturar.MetaKeywords = reader.GetString(colIndex);

        }
        internal static Manufacturar GetManufacturar(List<Manufacturar> Manufacturars, SqlDataReader reader)
        {
            int colIndex = 0;
            colIndex = reader.GetOrdinal(CN_MANUFACTURARE_ID);
            int value = reader.GetInt32(colIndex);

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