コード例 #1
0
        private void StartLoadContactDetail(int id)
        {
            try
            {
                var result = ContactsDAL.Get(id);
                if (result.Code < 0)
                {
                    lbError.InnerText = result.ErrorMessage;
                    lbError.Visible   = true;

                    return;
                }

                lbError.Visible = false;
                //----
                ContactBOL BOL = new ContactBOL(result.Data.Tables[0].Rows[0]);
                lbHeader.InnerText = BOL.Subject_VN;
                ltrContent.Text    = BOL.Content_VN;
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException("[ContactDetail][StartLoadContactDetail]", ex.ToString());
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
        }
コード例 #2
0
        protected void lvProjectImages_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            string tag = _tag + "[lvProjectImages_ItemDataBound]";

            //---
            if (e.Item.ItemType != ListViewItemType.DataItem)
            {
                return;
            }

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

            try
            {
                string      imageLink = e.Item.DataItem.ToString();
                HiddenField hfImage   = (HiddenField)e.Item.FindControl("hfImageLink");
                Image       img       = (Image)e.Item.FindControl("itemImage");
                //---
                hfImage.Value = imageLink;
                img.ImageUrl  = "~/" + Path.Combine(Utilities.GetDirectory("ImagesDir"), imageLink);
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End...");
            }
        }
コード例 #3
0
        private void StartBindingCategory()
        {
            string tag = _tag + "[StartBindingCategory]";

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

            try
            {
                var result = MenuDAL.GetAllSubMenuProjects();
                if (result.Code < 0)
                {
                    lbError.InnerText = result.ErrorMessage;
                    lbError.Visible   = true;
                    LogHelpers.WriteError(tag, result.ErrorMessage);

                    return;
                }
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                //--
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
コード例 #4
0
        private void StartLoadProjectImages(string imageLinks)
        {
            string tag = _tag + "[StartLoadProjectImages]";

            LogHelpers.WriteStatus(tag, "ImageLinks: " + imageLinks, "Start...");
            //---
            if (string.IsNullOrEmpty(imageLinks))
            {
                return;
            }

            try
            {
                hfListImage.Value = imageLinks;
                //---
                string[] images = imageLinks.Split('|');
                if (images != null && images.Length > 0)
                {
                    lvProjectImages.DataSource = images.ToList();
                    lvProjectImages.DataBind();
                }
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "ImageLinks: " + imageLinks, "End.");
            }
        }
コード例 #5
0
ファイル: Utilities.cs プロジェクト: tnhhcmus/Projects
        public static string SaveMutipleFileToServer(string[] images, string dir)
        {
            string tag = "[Utilities][Utilities]";

            LogHelpers.WriteStatus(tag, "Start...");
            //---
            string result = string.Empty;

            try
            {
                foreach (string filePath in images)
                {
                    string uploadFile = UploadFileToServer(filePath, dir);
                    //---
                    if (string.IsNullOrEmpty(result))
                    {
                        result = uploadFile;
                    }
                    else
                    {
                        result += "|" + uploadFile;
                    }
                }

                return(result);
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());

                return(result);
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }