Esempio n. 1
0
        public void StartLoadAboutDetail()
        {
            string tag = "[ucAbout][StartLoadAboutDetail]";

            var result = AboutsDAL.Get();

            if (result.Code < 0)
            {
                lbError.InnerText = result.ErrorMessage;
                lbError.Visible   = true;
                return;
            }

            lbError.Visible = false;
            try
            {
                AboutBOL about = new AboutBOL(result.Data.Tables[0].Rows[0]);
                hfId.Value         = about.Id.ToString();
                tbxNameVN.Text     = about.Name_VN;
                tbxNameEN.Text     = about.Name_EN;
                tbxAddress.Text    = about.Address_VN;
                tbxAddressEN.Text  = about.Address_EN;
                tbxFax.Text        = about.Fax;
                tbxPhone.Text      = about.Phone;
                tbxEmail.Text      = about.Email;
                tbxGoogleCode.Text = about.GoogleMaps;
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                //---
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
        }
Esempio n. 2
0
        private AboutBOL CreateAboutObject()
        {
            string tag = "[ucAbout][CreateAboutObject]";

            try
            {
                AboutBOL about = new AboutBOL()
                {
                    Id         = string.IsNullOrEmpty(hfId.Value) ? 0 : int.Parse(hfId.Value),
                    Name_VN    = tbxNameVN.Text,
                    Name_EN    = tbxNameEN.Text,
                    Address_VN = tbxAddress.Text,
                    Address_EN = tbxAddressEN.Text,
                    Phone      = tbxPhone.Text,
                    Fax        = tbxFax.Text,
                    Email      = tbxEmail.Text,
                    WebSite    = tbxWebSite.Text,
                    GoogleMaps = tbxGoogleCode.Text
                };

                about.ImageLink = StartUploadImage();

                //--
                return(about);
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;

                return(null);
            }
        }
Esempio n. 3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            AboutBOL obj = CreateAboutObject();
            //--
            var result = AboutsDAL.InsertOrUpdate(obj);

            if (result.Code < 0)
            {
                lbError.InnerText = result.ErrorMessage;
                lbError.Visible   = true;

                return;
            }

            lbError.Visible = false;
        }
Esempio n. 4
0
        private void GetLogo()
        {
            ResultBOL <DataSet> result = AboutsDAL.Get();

            if (result.Code < 0)
            {
                _log.Error(result.ErrorMessage);
            }
            else if (result.Data != null && result.Data.Tables.Count > 0 && result.Data.Tables[0].Rows.Count > 0)
            {
                AboutBOL about = new AboutBOL(result.Data.Tables[0].Rows[0]);
                if (!string.IsNullOrEmpty(about.ImageLink))
                {
                    this.imgLogo.Src = "~/" + Path.Combine(Utilities.GetDirectory("ImagesDir"), about.ImageLink);
                }
            }
        }
Esempio n. 5
0
        private void StartLoadContactInfo()
        {
            string tag = __tag + "[StartLoadContactInfo]";

            LogHelpers.WriteStatus(tag, "Start...");

            try
            {
                var result = AboutsDAL.GetAll();
                if (result.Code < 0)
                {
                    LogHelpers.WriteError(tag, result.ErrorMessage);
                }

                AboutBOL about = new AboutBOL(result.Data.Tables[0].Rows[0]);
                if (Utilities.IsLangueEN())
                {
                    lbName.InnerText        = about.Name_EN;
                    lbAddress.InnerText     = "Address:";
                    lbAddressInfo.InnerText = about.Address_EN;
                    lbPhone.InnerText       = "Phone:";
                }
                else
                {
                    lbName.InnerText        = about.Name_VN;
                    lbAddress.InnerText     = "Địa chỉ:";
                    lbAddressInfo.InnerText = about.Address_VN;
                    lbPhone.InnerText       = "Điện thoại:";
                }

                lbPhoneInfo.InnerText = about.Phone;
                lbFaxInfo.InnerText   = about.Fax;
                lbEmailInfo.InnerText = about.Email;
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
Esempio n. 6
0
        public static ResultBOL <int> InsertOrUpdate(AboutBOL about)
        {
            if (about == null)
            {
                return(new ResultBOL <int>()
                {
                    Code = -20,
                    ErrorMessage = Utilities.GetErrorMessage("NullObject")
                });
            }

            string stored = "sp_About_Insert_Update";

            about.InsertDate  = DateTime.Now;
            about.UpdatedDate = DateTime.Now;

            var result = DataAccessHelpers.ExecuteStored(stored, about.GetParameters());

            return(result);
        }
Esempio n. 7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            AboutBOL obj = CreateAboutObject();

            if (!string.IsNullOrEmpty(obj.ImageLink))
            {
                imgImage.ImageUrl = "~/" + Path.Combine(Utilities.GetDirectory("ImagesDir"), obj.ImageLink);
            }
            //--
            var result = AboutsDAL.InsertOrUpdate(obj);

            if (result.Code < 0)
            {
                lbError.InnerText = result.ErrorMessage;
                lbError.Visible   = true;

                return;
            }

            lbError.Visible = false;
        }
Esempio n. 8
0
        public void StartLoadAboutDetail()
        {
            string tag = "[ucAbout][StartLoadAboutDetail]";

            var result = AboutsDAL.Get();

            if (result.Code < 0)
            {
                lbError.InnerText = result.ErrorMessage;
                lbError.Visible   = true;
                return;
            }

            lbError.Visible = false;
            try
            {
                AboutBOL about = new AboutBOL(result.Data.Tables[0].Rows[0]);
                hfId.Value         = about.Id.ToString();
                tbxNameVN.Text     = about.Name_VN;
                tbxNameEN.Text     = about.Name_EN;
                tbxAddress.Text    = about.Address_VN;
                tbxAddressEN.Text  = about.Address_EN;
                tbxFax.Text        = about.Fax;
                tbxPhone.Text      = about.Phone;
                tbxEmail.Text      = about.Email;
                tbxWebSite.Text    = about.WebSite;
                tbxGoogleCode.Text = about.GoogleMaps;
                if (!string.IsNullOrEmpty(about.ImageLink))
                {
                    imgImage.ImageUrl = "~/" + Path.Combine(Utilities.GetDirectory("ImagesDir"), about.ImageLink);
                }
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                //---
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
        }