コード例 #1
0
ファイル: ContentsBO.cs プロジェクト: califaxit/manhquang
        public List <vw_ContentsViewAll> Sel_Ext_ByKeyCodeCategoryLevel1(string Key, bool Disable)
        {
            try
            {
                ConfigsBO        aConfigsBO        = new ConfigsBO();
                CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();

                // string Code = aConfigsBO.Sel_ByAccessKey(Key).Value;

                // return this.aDatabaseDA.vw_ContentsViewAll.Where(p => p.CategoryLevel1_Code == Code).Where(p => p.Contents_Disable == Disable).ToList();

                List <Configs> ListConfigs = aConfigsBO.Sel_ByAccessKey(Key);
                List <string>  ListCode    = new List <string>();

                for (int i = 0; i < ListConfigs.Count; i++)
                {
                    ListCode.Add(ListConfigs[i].Value.ToString());
                }

                string ListCodeTempt = String.Join(",", ListCode);
                //return this.aDatabaseDA.vw_CategoryLevel1ViewAll.Where(p => p.CategoryLevel1_Code.Contains(ListCodeTempt)).Where(p => p.CategoryLevel1_CategoryLevel2_IDLang == IDLang).ToList();
                return(this.aDatabaseDA.vw_ContentsViewAll.Where(p => ListCodeTempt.Contains(p.Contents_Code)).Where(p => p.Contents_Disable == Disable).ToList());
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("ContentsBO.Sel_ByKeyCodeCategoryLevel1_ByIDLang: {0}", ex.Message));
            }
        }
コード例 #2
0
        public static void INIT(string SystemKey)
        {
            CORE.SYSTEM.SystemKey = SystemKey;
            ConfigsBO aConfigsBO = new ConfigsBO();

            CORE.SYSTEM.ListConfig = aConfigsBO.Select_All().Where(p => p.Group == CORE.SYSTEM.SystemKey.ToString()).ToList();
            CORE.CONSTANTS.LoadAllConstant();
        }
コード例 #3
0
 private void frmUpd_Configs_Load(object sender, EventArgs e)
 {
     try
     {
         ConfigsBO aConfigsBO = new ConfigsBO();
         Configs aConfigs = aConfigsBO.Select_ByID(ID);
         txtAccessKey.Text = aConfigs.AccessKey;
         txtValue.Text = aConfigs.Value;
         cboStatus.Text = aConfigs.Status.ToString();
         cboType.Text = aConfigs.Type.ToString();
         cboGroup.Text = aConfigs.Group.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show("frmUpd_Configs.frmUpd_Configs_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #4
0
 private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     int ID = Convert.ToInt32(viewConfigs.GetFocusedRowCellValue("ID"));
     DialogResult result = MessageBox.Show("Bạn có chắc chắn muốn xóa ???", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
     if (DialogResult.Yes == result)
     {
         try
         {
             ConfigsBO aConfigsBO = new ConfigsBO();
             aConfigsBO.Delete(ID);
             MessageBox.Show("Bạn đã xóa dữ liệu thành công .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         catch (Exception ex)
         {
             MessageBox.Show("frmLst_Configs.btnDelete_ButtonClick\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     LoadDataConfigs(AccessKey);
 }
コード例 #5
0
        public List <vw_FilesViewAll> Sel_Ext_ByKeyCodeAlbums(string Key)
        {
            try
            {
                ConfigsBO aConfigsBO = new ConfigsBO();

                List <Configs> ListConfig = aConfigsBO.Sel_ByAccessKey(Key);
                List <string>  ListCode   = new List <string>();
                for (int i = 0; i < ListConfig.Count; i++)
                {
                    ListCode.Add(ListConfig[i].Value.ToString());
                }
                string ListCodeTempt = String.Join(",", ListCode);

                return(this.aDatabaseDA.vw_FilesViewAll.Where(p => p.Files_Code.Contains(ListCodeTempt)).ToList());
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("ContentsBO.SelectContents_ByCode_002: {0}", ex.Message));
            }
        }
コード例 #6
0
        private void btnAddNew_Click(object sender, EventArgs e)
        {
            try
            {
                string accessKey = txtAccessKey.Text;
                string value = txtValue.Text;
                if (accessKey.Length > 250)
                {
                    txtAccessKey.Focus();
                    MessageBox.Show("AccessKey chỉ được phép nhập tối đa 250 ký tự .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (value.Length > 250)
                {
                    txtValue.Focus();
                    MessageBox.Show("Giá trị chỉ được phép nhập tối đa 250 ký tự .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    ConfigsBO aConfigBO = new ConfigsBO();
                    Configs aConfigs = new Configs();
                    aConfigs.AccessKey = accessKey;
                    aConfigs.Value = value;
                    aConfigs.Status = cboStatus.SelectedIndex + 1;
                    aConfigs.Type = cboType.SelectedIndex + 1;
                    aConfigs.Group = (cboGroup.SelectedIndex + 1).ToString();
                    aConfigBO.Insert(aConfigs);
                    MessageBox.Show("Thêm mới thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                    if(this.afrmLst_Configs !=null)
                    {
                        this.afrmLst_Configs.LoadDataConfigs(AccessKey);
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_Configs.btnAddNew_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         ConfigsBO aConfigsBO = new ConfigsBO();
         Configs aConfigs = new Configs();
         aConfigs.ID = ID;
         aConfigs.AccessKey = txtAccessKey.Text;
         aConfigs.Value = txtValue.Text;
         aConfigs.Status = cboStatus.SelectedIndex + 1;
         aConfigs.Type = cboType.SelectedIndex + 1;
         aConfigs.Group =  (cboGroup.SelectedIndex + 1).ToString();
         aConfigsBO.Update(aConfigs);
         MessageBox.Show("Cập nhật dữ liệu thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
         this.afrmLst_Configs.LoadDataConfigs(AccessKey);
     }
     catch(Exception ex)
     {
         MessageBox.Show("frmUpd_Configs.btnSave_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #8
0
        public void LoadDataConfigs(string AccessKey)
        {
            try
            {
                ConfigsBO aConfigBO = new ConfigsBO();
                List<Configs> aListConfigs = new List<Configs>();

                if (AccessKey == null)
                {
                    aListConfigs = aConfigBO.Select_All();
                }
                else
                {
                    aListConfigs = aConfigBO.SearchListConfigs_ByAccessKey(AccessKey);
                }
                dgvConfigs.DataSource = aListConfigs;
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmLst_Configs.LoadDataConfigs\n" + ex.ToString());
            }
        }
コード例 #9
0
ファイル: ConfigsActiton.cs プロジェクト: califaxit/manhquang
        private void Sel_ByType_ByStatus(HttpContext context)
        {
            String jSonString = "";
            ConfigsBO configsBO = new ConfigsBO();

            int type = Convert.ToInt32(context.Request.QueryString["Type"]);
            int status = Convert.ToInt32(context.Request.QueryString["Status"]);
            bool disable = !String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? Convert.ToBoolean(context.Request.QueryString["Disable"])
                : false;
            List<Configs> listConfigs = String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? configsBO.Sel_ByType_ByStatus(type, status)
                : configsBO.Sel_ByType_ByStatus(type, status, disable);

            if (listConfigs.Any()) {
                _converter.DateTimeFormat = "dd/MM/yyyy";
                jSonString = JsonConvert.SerializeObject(listConfigs, _converter);
            }
            jSonString = "{\"data\":" + jSonString + "}";

            context.Response.Write(jSonString);
        }
コード例 #10
0
ファイル: FilesBO.cs プロジェクト: califaxit/manhquang
        public List<vw_FilesViewAll> Sel_Ext_ByKeyCodeFiles_ByIDLang(string Key, int IDLang, bool Disable)
        {
            try
             {
                 ConfigsBO aConfigsBO = new ConfigsBO();

                 List<Configs> ListConfig = aConfigsBO.Sel_ByAccessKey(Key);
                 List<string> ListCode = new List<string>();
                 for (int i = 0; i < ListConfig.Count; i++)
                 {
                     ListCode.Add(ListConfig[i].Value.ToString());
                 }
                 string ListCodeTempt = String.Join(",", ListCode);

                 return this.aDatabaseDA.vw_FilesViewAll.Where(p => p.Files_Code.Contains(ListCodeTempt)).Where(p => p.Files_IDLang == IDLang).Where(p=>p.Files_Disable==Disable).ToList();

             }
             catch (Exception ex)
             {
                 throw new Exception(String.Format("ContentsBO.SelectContents_ByCode_002: {0}", ex.Message));
             }
        }
コード例 #11
0
ファイル: ]BO.cs プロジェクト: ntlzz93/ToolGenCode
        public List<vw_ContentsViewAll> Sel_Ext_ByKeyCodeCategoryLevel1(string Key)
        {
            try
            {
                ConfigsBO aConfigsBO = new ConfigsBO();
                CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();

                string Code = aConfigsBO.Sel_ByAccessKey(Key).Value;

                return this.aDatabaseDA.vw_ContentsViewAll.Where(p => p.CategoryLevel1_Code == Code).ToList();

            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("ContentsBO.Sel_ByKeyCodeCategoryLevel1_ByIDLang: {0}", ex.Message));
            }
        }
コード例 #12
0
ファイル: ]BO.cs プロジェクト: ntlzz93/ToolGenCode
        public List<vw_ContentsViewAll> Sel_Ext_ByKeyCodeContents_ByIDLang(string Key, int IDLang, bool Disable)
        {
            try
            {
                ConfigsBO aConfigsBO = new ConfigsBO();
                CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();

                string Code = aConfigsBO.Sel_ByAccessKey(Key).Value;

                return this.aDatabaseDA.vw_ContentsViewAll.Where(p => p.Contents_Code == Code).Where(p => p.Contents_CategoryLevel1_IDLang == IDLang).Where(p => p.Contents_Disable == Disable).ToList();

            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("ContentsBO.SelectContents_ByCode_002: {0}", ex.Message));
            }
        }
コード例 #13
0
        public void Sel_ByCodeCategoryLevel2(HttpContext context, int IDLang)
        {
            ConfigsBO aConfigsBO = new ConfigsBO();
            String jSonString = "";
            string CodeCategoryLevel2 = "";
            CodeCategoryLevel2 = context.Request.QueryString["CodeCat2"];

            CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();

            //List<CategoryLevel1> obj = aCategoryLevel1BO.Sel_ByIDLang(IDLang).Where(p => !p.CodeCategoryLevel2.Contains(CodeCategoryLevel2)).ToList<CategoryLevel1>();
            List<vw_CategoryLevel1ViewAll> obj = aCategoryLevel1BO.Sel_Ext_ByCodeCategoryLevel2(CodeCategoryLevel2).ToList();

            if (obj != null)
            {
                _converter.DateTimeFormat = "dd/MM/yyyy";

                jSonString = JsonConvert.SerializeObject(obj, _converter);
            }
            jSonString = "{\"CategoryLevel1s\":" + jSonString + "}";
            context.Response.Write(jSonString);
        }
コード例 #14
0
ファイル: ContentsBO.cs プロジェクト: califaxit/manhquang
        //KhoiDT select content by code cat 1
        //=============================================================================================
        public List<vw_ContentsViewAll> Sel_Ext_ByKeyCodeCategoryLevel1_ByIDLang(string Key, int IDLang)
        {
            try
            {
                ConfigsBO aConfigsBO = new ConfigsBO();
                CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();

                List<Configs> ListConfigs = aConfigsBO.Sel_ByAccessKey(Key);
                List<string> ListCode = new List<string>();

                for (int i = 0; i < ListConfigs.Count; i++)
                {
                    ListCode.Add(ListConfigs[i].Value.ToString());
                }

                string ListCodeTempt = String.Join(",", ListCode);
                //return this.aDatabaseDA.vw_CategoryLevel1ViewAll.Where(p => p.CategoryLevel1_Code.Contains(ListCodeTempt)).Where(p => p.CategoryLevel1_CategoryLevel2_IDLang == IDLang).ToList();
                return this.aDatabaseDA.vw_ContentsViewAll.Where(p => ListCodeTempt.Contains(p.CategoryLevel1_Code)).Where(p => p.Contents_CategoryLevel1_IDLang == IDLang).ToList();
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("ContentsBO.Sel_ByKeyCodeCategoryLevel1_ByIDLang: {0}", ex.Message));
            }
        }
コード例 #15
0
ファイル: CORE_Language.cs プロジェクト: califaxit/manhquang
        //
        //-------- Danh cho phuong phap lay ngon ngu moi -------------
        public static void Load_Language(string SYSTEM)
        {
            LanguagesBO aLanguagesBO = new LanguagesBO();
            ConfigsBO aConfigsBO = new ConfigsBO();
            List<Configs> ListConfigsCMS = new List<Configs>();
            List<string> ListCodeCMS = new List<string>();
            ListConfigsCMS = aConfigsBO.Sel_ByAccessKey(key_DEF_LANG_CMS);
            for (int i = 0; i < ListConfigsCMS.Count; i++)
            {
                ListCodeCMS.Add(ListConfigsCMS[i].Value.ToString());
            }
            string ListCodeTemptCMS = String.Join(",", ListCodeCMS);
            List<Configs> ListConfigsWEB = new List<Configs>();
            List<string> ListCodeWEB = new List<string>();
            ListConfigsWEB = aConfigsBO.Sel_ByAccessKey(key_DEF_LANG_WEB);
            for (int i = 0; i < ListConfigsCMS.Count; i++)
            {
                ListCodeWEB.Add(ListConfigsWEB[i].Value.ToString());
            }
            string ListCodeTemptWEB = String.Join(",", ListCodeWEB);
            sys_NUM_LANG = aLanguagesBO.Sel().ToList().Count;

            if (SYSTEM == "CMS")
            {
                sys_DEF_LANG = int.Parse(ListCodeTemptCMS);
                sys_CUR_LANG = int.Parse(ListCodeTemptCMS);
            }
            else if (SYSTEM == "WEB")
            {
                sys_DEF_LANG = int.Parse(ListCodeTemptWEB);
                sys_CUR_LANG = int.Parse(ListCodeTemptWEB);
            }
        }
コード例 #16
0
ファイル: ConfigsActiton.cs プロジェクト: califaxit/manhquang
        private void Sel_ByID(HttpContext context)
        {
            string jSonString = string.Empty;
            ConfigsBO configsBO = new ConfigsBO();
            int id = Convert.ToInt32(context.Request.QueryString["ID"]);
            bool disable = !String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? Convert.ToBoolean(context.Request.QueryString["Disable"])
                : false;
            Configs configs = String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? configsBO.Sel_ByID(id)
                : configsBO.Sel_ByID(id, disable);
            if (configs != null) {
                _converter.DateTimeFormat = "dd/MM/yyyy";
                jSonString = JsonConvert.SerializeObject(configs, _converter);
            }
            jSonString = "{\"data\":" + jSonString + "}";

            context.Response.Write(jSonString);
        }
コード例 #17
0
ファイル: ConfigsActiton.cs プロジェクト: califaxit/manhquang
        private void Sel_ByAccessKey(HttpContext context)
        {
            string jSonString = string.Empty;
            ConfigsBO configsBO = new ConfigsBO();
            string accessKey = context.Request.QueryString["AccessKey"];
            bool disable = !String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? Convert.ToBoolean(context.Request.QueryString["Disable"])
                : false;
            List<Configs> listConfigs = String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"]))
                ? configsBO.Sel_ByAccessKey(accessKey)
                : configsBO.Sel_ByAccessKey(accessKey, disable);
            if (listConfigs.Any()) {
                _converter.DateTimeFormat = "dd/MM/yyyy";
                jSonString = JsonConvert.SerializeObject(listConfigs, _converter);
            }
            jSonString = "{\"data\":" + jSonString + "}";

            context.Response.Write(jSonString);
        }
コード例 #18
0
ファイル: ConfigsActiton.cs プロジェクト: califaxit/manhquang
        private void Ins(HttpContext context)
        {
            String jSonString = "";
            try {
                Configs aConfigs = new Configs {
                    AccessKey =
                        !String.IsNullOrEmpty(context.Request.Form["txtAccessKey"])
                            ? Convert.ToString(context.Request.Form["txtAccessKey"])
                            : "",
                    Value =
                        !String.IsNullOrEmpty(context.Request.Form["txtValue"])
                            ? Convert.ToString(context.Request.Form["txtValue"])
                            : "",
                    Status =
                        !String.IsNullOrEmpty(context.Request.Form["cbbStatus"])
                            ? Convert.ToInt32(context.Request.Form["cbbStatus"])
                            : 0,
                    Type =
                        !String.IsNullOrEmpty(context.Request.Form["cbbType"])
                            ? Convert.ToInt32(context.Request.Form["cbbType"])
                            : 0,
                    Group =
                        !String.IsNullOrEmpty(context.Request.Form["cbbGroup"])
                            ? Convert.ToInt32(context.Request.Form["cbbGroup"])
                            : 0,
                    Note =
                        !String.IsNullOrEmpty(context.Request.Form["txtNote"])
                            ? Convert.ToString(context.Request.Form["txtNote"])
                            : "",
                    Image =
                        !String.IsNullOrEmpty(context.Request.Form["txtImage_1"])
                            ? Convert.ToString(context.Request.Form["txtImage_1"])
                            : "",
                    Disable =
                        !String.IsNullOrEmpty(context.Request.Form["cbbDisable"])
                            ? Convert.ToBoolean(context.Request.Form["cbbDisable"])
                            : false,
                };

                ConfigsBO configsBO = new ConfigsBO();
                int ret = configsBO.Ins(aConfigs);

                if (ret != 0) jSonString = "{\"status\": \"success\"}";
                if (ret == 0) jSonString = "{\"status\":\"error|" + ret + "\"}";
            }
            catch (Exception ex) {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}";
            }
            finally {
                context.Response.Write(jSonString);
            }
        }
コード例 #19
0
        public void Ins(HttpContext context, int NUM_LANG)
        {
            ConfigsBO aConfigsBO = new ConfigsBO();

            //CodeCategoryLevel1 = Convert.ToString(context.Request.Form["txtCodeCategoryLevel1"]);

            String jSonString = "";
            try
            {
                List<ExtendProperties> aListExtendProperties = new List<ExtendProperties>();

                ExtendPropertiesBO aExtendPropertiesBO = new ExtendPropertiesBO();
                ExtendProperties aExtendProperties = new ExtendProperties();
                TimeSpan Codespan = new TimeSpan(DateTime.Now.Ticks);
                string Code = Math.Floor(Codespan.TotalSeconds).ToString();

                for (int i = 1; i <= NUM_LANG; i++)
                {
                    aExtendProperties = new ExtendProperties();
                    aExtendProperties.Code = Code;
                    //aContents.Data = null;
                    aExtendProperties.Name = !String.IsNullOrEmpty(context.Request.Form["txtName"]) ? Convert.ToString(context.Request.Form["txtName"]) : "";
                    aExtendProperties.Value = !String.IsNullOrEmpty(context.Request.Form["txtValue"]) ? Convert.ToString(context.Request.Form["txtValue"]) : "";
                    aExtendProperties.ValueType = !String.IsNullOrEmpty(context.Request.Form["cbbValueType"]) ? Convert.ToInt32(context.Request.Form["cbbValueType"]) : 0;
                    aExtendProperties.Image = !String.IsNullOrEmpty(context.Request.Form["txtImage"]) ? Convert.ToString(context.Request.Form["txtImage"]) : "";
                    aExtendProperties.Code = Code;
                    aExtendProperties.IDObject = !String.IsNullOrEmpty(context.Request.Form["cbbIDObject"]) ? Convert.ToInt32(context.Request.Form["cbbIDObject"]) : 0;
                    aExtendProperties.ObjectType = !String.IsNullOrEmpty(context.Request.Form["cbbObjectType"]) ? Convert.ToInt32(context.Request.Form["cbbObjectType"]) : 0;
                    aExtendProperties.IDLang = !String.IsNullOrEmpty(context.Request.Form["IDLang_" + i]) ? Convert.ToInt32(context.Request.Form["IDLang_" + i]) : 0;
                    aExtendProperties.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : 0;
                    aExtendProperties.Group = !String.IsNullOrEmpty(context.Request.Form["cbbGroup"]) ? Convert.ToInt32(context.Request.Form["cbbGroup"]) : 0;
                    aExtendProperties.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : 0;
                    aExtendProperties.CodeObject = !String.IsNullOrEmpty(context.Request.Form["cbbCodeObject"]) ? Convert.ToInt32(context.Request.Form["cbbCodeObject"]) : 0;

                    //aContents.CreatedBy = aCurrentSystemUsers.Username;

                    aExtendProperties.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : false;
                    //aContents.Tag = !String.IsNullOrEmpty(context.Request.Form["txtTag"]) ? Convert.ToString(context.Request.Form["txtTag"]) : "";
                    //aContents.DateCreated = !String.IsNullOrEmpty(context.Request.FormCodeObjecttxtDateCreated"]) ? DateTime.ParseExact(context.Request.Form["txtDateCreated"], "dd/MM/yyyy", culture) : DateTime.Now;

                    //aContents.DateEdited = !String.IsNullOrEmpty(context.Request.Form["txtDateEdited"]) ? DateTime.ParseExact(context.Request.Form["txtDateEdited"], "dd/MM/yyyy", culture) : DateTime.Now;
                    //aContents.UpdateBy = !String.IsNullOrEmpty(context.Request.Form["txtUpdateBy"]) ? Convert.ToString(context.Request.Form["txtUpdateBy"]) : "";
                    //aContents.PublishDate = !String.IsNullOrEmpty(context.Request.Form["txtPublishDate"]) ? DateTime.ParseExact(context.Request.Form["txtPublishDate"], "dd/MM/yyyy", culture) : DateTime.Now;

                    //aContents.ExpireDate = !String.IsNullOrEmpty(context.Request.Form["txtExpireDate"]) ? DateTime.ParseExact(context.Request.Form["txtExpireDate"], "dd/MM/yyyy", culture) : DateTime.Now;
                    //aContents.IDAlbum = !String.IsNullOrEmpty(context.Request.Form["txtIDAlbum"]) ? Convert.ToInt32(context.Request.Form["txtIDAlbum"]) : 0;
                    //aContents.ViewCount = !String.IsNullOrEmpty(context.Request.Form["txtViewCount"]) ? Convert.ToInt64(context.Request.Form["txtViewCount"]) : 0;

                    aExtendProperties.Image = !String.IsNullOrEmpty(context.Request.Form["txtImage"]) ? Convert.ToString(context.Request.Form["txtImage"]) : "";
                    //aContents.Image2 = !String.IsNullOrEmpty(context.Request.Form["txtImage_3"]) ? Convert.ToString(context.Request.Form["txtImage_3"]) : "";
                    //aContents.Image3 = !String.IsNullOrEmpty(context.Request.Form["txtImage_4"]) ? Convert.ToString(context.Request.Form["txtImage_4"]) : "";

                    //aContents.Title = !String.IsNullOrEmpty(context.Request.Form["txtTitle_Lang" + i]) ? Convert.ToString(context.Request.Form["txtTitle_Lang" + i]) : "";
                    //aContents.Intro = !String.IsNullOrEmpty(context.Request.Form["txtIntro_Lang" + i]) ? Convert.ToString(HttpUtility.HtmlDecode(context.Request.Form["txtIntro_Lang" + i])) : "";
                    //aContents.Info = !String.IsNullOrEmpty(context.Request.Form["txtInfo_Lang" + i]) ? Convert.ToString(HttpUtility.HtmlDecode(context.Request.Form["txtInfo_Lang" + i])) : "";

                    //aContents.ExtendProperties1 = !String.IsNullOrEmpty(context.Request.Form["txtExtendProperties1_Lang" + i]) ? Convert.ToString(context.Request.Form["txtExtendProperties1_Lang" + i]) : "";
                    //aContents.ExtendProperties2 = !String.IsNullOrEmpty(context.Request.Form["txtExtendProperties2_Lang" + i]) ? Convert.ToString(context.Request.Form["txtExtendProperties2_Lang" + i]) : "";
                    //aContents.ExtendProperties3 = !String.IsNullOrEmpty(context.Request.Form["txtExtendProperties3_Lang" + i]) ? Convert.ToString(context.Request.Form["txtExtendProperties3_Lang" + i]) : "";

                    //aContents.Image = !String.IsNullOrEmpty(context.Request.Form["txtImage_1"]) ? Convert.ToString(context.Request.Form["txtImage_1"]) : "";

                    aListExtendProperties.Add(aExtendProperties);
                }

                int Ret1 = -1;
                Ret1 = aExtendPropertiesBO.Ins(ref aListExtendProperties);
                //if (Ret1 < aListExtendProperties.Count)
                //{
                //    jSonString = "{\"status\":\"error\" ,\"message\":\"" + Ret1.ToString() + "\"}";
                //     aExtendPropertiesBO.Del(aListExtendProperties);
                //    return;
                //}
                //else
                //{
                //    string ListTempt = !String.IsNullOrEmpty(context.Request.Form["ckbCodeCategoryLevel1[]"]) ? Convert.ToString(context.Request.Form["ckbCodeCategoryLevel1[]"]) : "";
                //    if (string.IsNullOrEmpty(ListTempt) == true)
                //    {
                //        CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();
                //        List<CategoryLevel1> aListItem = aCategoryLevel1BO.Sel_ByCode("000");
                //        if (aListItem.Count > 0)
                //        {
                //            ListTempt = aListItem[0].Code;
                //        }
                //        else
                //        {
                //            this.CreateCategoryLevel1Default(context, "[Default]", NUM_LANG);
                //            ListTempt = "000";
                //        }
                //    }

                //    //else if (string.IsNullOrEmpty(ListTempt) == false)
                //    //{
                //    List<string> ListCodeCategoryLevel1 = ListTempt.Split(',').ToList();
                //    List<Contents_CategoryLevel1> aListContents_CategoryLevel1 = new List<Contents_CategoryLevel1>();
                //    Contents_CategoryLevel1 aContents_CategoryLevel1 = new Contents_CategoryLevel1();

                //    for (int ii = 0; ii < aListContents.Count; ii++)
                //    {
                //        for (int iii = 0; iii < ListCodeCategoryLevel1.Count; iii++)
                //        {
                //            aContents_CategoryLevel1 = new Contents_CategoryLevel1();

                //            aContents_CategoryLevel1.CodeCategoryLevel1 = ListCodeCategoryLevel1[iii].ToString();
                //            aContents_CategoryLevel1.CodeContents = aListContents[ii].Code.ToString();
                //            aContents_CategoryLevel1.Disable = aListContents[ii].Disable;
                //            aContents_CategoryLevel1.IDLang = aListContents[ii].IDLang;
                //            aContents_CategoryLevel1.Status = aListContents[ii].Status;
                //            aContents_CategoryLevel1.Type = aListContents[ii].Type;

                //            aListContents_CategoryLevel1.Add(aContents_CategoryLevel1);
                //        }
                //    }
                //    Contents_CategoryLevel1BO aContents_CategoryLevel1BO = new Contents_CategoryLevel1BO();
                //    int Ret2 = -1;
                //    Ret2 = aContents_CategoryLevel1BO.Ins(ref aListContents_CategoryLevel1);
                //    if (Ret2 < aListContents_CategoryLevel1.Count)
                //    {
                //        aContents_CategoryLevel1BO.Del(aListContents_CategoryLevel1);
                //        aContentsBO.Del(aListContents);
                //        jSonString = "{\"status\":\"error\" ,\"message\":\"" + Ret2.ToString() + "\"}";
                //        return;
                //    }
                //    //}
                //}

                jSonString = "{\"status\": \"success\"}";
            }
            catch (Exception ex)
            {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}";
            }
            finally
            {
                context.Response.Write(jSonString);
            }
        }
コード例 #20
0
ファイル: CORE_Language.cs プロジェクト: califaxit/manhquang
        public static string Load_DynamicDataLanguage_Page(HttpContext Context, string SYSTEM)
        {
            string PageHTML = Context.Request["filename"].ToString();
            LanguagesBO aLanguagesBO = new LanguagesBO();

            ConfigsBO aConfigsBO = new ConfigsBO();
            List<Configs> ListConfigsCMS = new List<Configs>();
            List<string> ListCodeCMS = new List<string>();
            ListConfigsCMS = aConfigsBO.Sel_ByAccessKey(key_DEF_LANG_CMS);
            for (int i = 0; i < ListConfigsCMS.Count; i++)
            {
                ListCodeCMS.Add(ListConfigsCMS[i].Value.ToString());
            }
            string ListCodeTemptCMS = String.Join(",", ListCodeCMS);
            List<Configs> ListConfigsWEB = new List<Configs>();
            List<string> ListCodeWEB = new List<string>();
            ListConfigsWEB = aConfigsBO.Sel_ByAccessKey(key_DEF_LANG_WEB);
            for (int i = 0; i < ListConfigsCMS.Count; i++)
            {
                ListCodeWEB.Add(ListConfigsWEB[i].Value.ToString());
            }
            string ListCodeTemptWEB = String.Join(",", ListCodeWEB);

            sys_NUM_LANG = aLanguagesBO.Sel().ToList().Count;

            if (SYSTEM == "CMS")
            {
                sys_DEF_LANG = int.Parse(ListCodeTemptCMS);
            }
            else if (SYSTEM == "WEB")
            {
                sys_DEF_LANG = int.Parse(ListCodeTemptWEB);
            }

            if (!string.IsNullOrEmpty(Context.Request.QueryString["IDLang"]))
            {
                sys_CUR_LANG = Convert.ToInt32(Context.Request.QueryString["IDLang"]);
            }
            else
            {
                if (Context.GetSection(key_CUR_LANG) != null)
                {
                    sys_CUR_LANG = Convert.ToInt32(Context.GetSection(key_CUR_LANG).ToString());
                }
                // Cuoi cung moi lay den ngon ngu mac dinh
                else
                {
                    sys_CUR_LANG = int.Parse(ListCodeTemptCMS);
                }

            }

            string PhysicalPath = Context.Server.MapPath(@"\\Languages\\" + aLanguagesBO.Sel_ByID(sys_CUR_LANG).NameLang + "\\" + PageHTML + ".xml");
            XmlDocument doc = new XmlDocument();
            doc.Load(PhysicalPath);

            XmlElement element = doc.DocumentElement;
            XmlNodeList attr_coll = doc.SelectNodes("//item");

            List<LanguagesItem> List_ItemLang = new List<LanguagesItem>();

            LanguagesItem Item;
            foreach (XmlNode node in attr_coll)
            {
                Item = new LanguagesItem();
                Item.Text = node.InnerText;
                Item.Key = node.Attributes["Index"].Value;

                List_ItemLang.Add(Item);
            }

            String jSonString = "";

            InfoLang aInfoLang = new InfoLang();
            aInfoLang.DATA_LANG = List_ItemLang;
            aInfoLang.sys_CUR_LANG = sys_CUR_LANG;
            aInfoLang.sys_DEF_LANG = sys_DEF_LANG;
            aInfoLang.sys_NUM_LANG = sys_NUM_LANG;

            _converter.DateTimeFormat = "dd/MM/yyyy";

            jSonString = JsonConvert.SerializeObject(aInfoLang, _converter);

            CORE_Language.aInfoLang.DATA_LANG = List_ItemLang;  // Chỗ chứa dữ liệu cho cách thức truy cập từ trang aspx
            return jSonString;
        }
コード例 #21
0
ファイル: ConfigsActiton.cs プロジェクト: califaxit/manhquang
        private void Upd_ByID(HttpContext context)
        {
            String jSonString = "";
            try {
                int idConfigs = Convert.ToInt32(context.Request.Form["txtID"]);
                ConfigsBO configsBO = new ConfigsBO();
                Configs aConfigs = configsBO.Sel_ByID(idConfigs);

                aConfigs.ID = idConfigs;
                aConfigs.AccessKey = !String.IsNullOrEmpty(context.Request.Form["txtAccessKey"])
                    ? Convert.ToString(context.Request.Form["txtAccessKey"])
                    : aConfigs.AccessKey;
                aConfigs.Value = !String.IsNullOrEmpty(context.Request.Form["txtValue"])
                    ? Convert.ToString(context.Request.Form["txtValue"])
                    : aConfigs.Value;
                aConfigs.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"])
                    ? Convert.ToInt32(context.Request.Form["cbbStatus"])
                    : aConfigs.Status;
                aConfigs.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"])
                    ? Convert.ToInt32(context.Request.Form["cbbType"])
                    : aConfigs.Type;
                aConfigs.Group = !String.IsNullOrEmpty(context.Request.Form["cbbGroup"])
                    ? Convert.ToInt32(context.Request.Form["cbbGroup"])
                    : aConfigs.Group;
                aConfigs.Note = !String.IsNullOrEmpty(context.Request.Form["txtNote"])
                    ? Convert.ToString(context.Request.Form["txtNote"])
                    : aConfigs.Note;
                aConfigs.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"])
                    ? Convert.ToBoolean(context.Request.Form["cbbDisable"])
                    : aConfigs.Disable;
                aConfigs.Image = !String.IsNullOrEmpty(context.Request.Form["txtImage_1"])
                    ? Convert.ToString(context.Request.Form["txtImage_1"])
                    : aConfigs.Image;

                int ret = configsBO.Upd(aConfigs);

                if (ret != 0) jSonString = "{\"status\": \"success\"}";
                if (ret == 0) jSonString = "{\"status\":\"error|" + ret + "\"}";
            }
            catch (Exception ex) {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}";
            }
            finally {
                context.Response.Write(jSonString);
            }
        }
コード例 #22
0
        //===================================================================================================
        public List<vw_CategoryLevel2ViewAll> Sel_ByKeyCodeCategoryLevel2_ByIDLang(string Key, int IDLang, bool Disable)
        {
            try
            {
                ConfigsBO aConfigsBO = new ConfigsBO();
                CategoryLevel2BO aCategoryLevel2BO = new CategoryLevel2BO();

                // string Code = aConfigsBO.Sel_ByAccessKey(Key).Value;

                // return this.aDatabaseDA.vw_CategoryLevel2ViewAll.Where(p => p.Code == Code).Where(p => p.IDLang == IDLang).Where(p => p.Disable == Disable).ToList();

                List<Configs> ListConfigs = aConfigsBO.Sel_ByAccessKey(Key);
                List<string> ListCode = new List<string>();

                for (int i = 0; i < ListConfigs.Count; i++)
                {
                    ListCode.Add(ListConfigs[i].Value.ToString());
                }

                string ListCodeTempt = String.Join(",", ListCode);

                return this.aDatabaseDA.vw_CategoryLevel2ViewAll.Where(p => ListCodeTempt.Contains(p.Code)).Where(p => p.IDLang == IDLang).Where(p => p.Disable == Disable).ToList();

            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("CategoryLevel2BO.SelectCategoryLevel2_ByCode_002: {0}", ex.Message));
            }
        }
コード例 #23
0
ファイル: ConfigsActiton.cs プロジェクト: califaxit/manhquang
 private void Upd_Type_ByID(HttpContext context)
 {
     String jSonString = "";
     try {
         ConfigsBO configsBo = new ConfigsBO();
         int id = Convert.ToInt32(context.Request.QueryString["ID"]);
         int type = Convert.ToInt32(context.Request.QueryString["Type"]);
         int ret = configsBo.Upd_Type(id, type);
         if (ret == 0) jSonString = "{\"status\":\"error|" + ret + "\"}";
         if (ret != 0) jSonString = "{\"status\": \"success\"}";
     }
     catch (Exception ex) {
         jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}";
     }
     finally {
         context.Response.Write(jSonString);
     }
 }