コード例 #1
0
        public void StartBidingOtherType()
        {
            string tag = __tag + "[StartBidingOtherType]";

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

            lbError.Visible = false;

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

                _dataSource = result.Data.Tables[0];
                grvOtherItems.DataSource   = result.Data;
                grvOtherItems.DataKeyNames = new string[] { "Id" };
                grvOtherItems.DataBind();
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
コード例 #2
0
        private void StartBindingOtherTypeItems()
        {
            string tag = __tag + "[StartBindingOtherTypeItems]";

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

            try
            {
                var result = OtherTypeDAL.GetAll();
                if (result.Code < 0)
                {
                    lbError.InnerText = result.ErrorMessage;
                    lbError.Attributes.Remove("hidden");
                    return;
                }

                lbxOther.DataSource     = result.Data;
                lbxOther.DataTextField  = "Name_VN";
                lbxOther.DataValueField = "Id";
                lbxOther.DataBind();
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                lbError.InnerText = ex.Message;
                lbError.Attributes.Remove("hidden");
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
コード例 #3
0
ファイル: ucMainRight.ascx.cs プロジェクト: tnhhcmus/Projects
        private void StartBindingOtherType()
        {
            string tag = __tag + "[StartBindingOtherType]";

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

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

                lvMainRight.DataSource   = result.Data;
                lvMainRight.DataKeyNames = new string[] { "Id", "Name_VN", "Name_EN" };
                lvMainRight.DataBind();
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
コード例 #4
0
        private void StartAddMenuOther()
        {
            string tag = __tag + "[StartAddMenuOther]";

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

            try
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                li.InnerHtml = string.Format("<a href='{0}'>{1}</a>",
                                             "Other.aspx",
                                             "Other");

                var result = OtherTypeDAL.GetAll();
                if (result.Code >= 0 && result.Data.Tables.Count > 0)
                {
                    HtmlGenericControl ul = new HtmlGenericControl("ul");

                    foreach (DataRow row in result.Data.Tables[0].Rows)
                    {
                        OtherTypeBOL otherType = new OtherTypeBOL(row);
                        if (otherType == null)
                        {
                            continue;
                        }

                        HtmlGenericControl subLi = new HtmlGenericControl("li");
                        subLi.InnerHtml = string.Format("<a href='{0}?CatId={1}'>{2}</a>",
                                                        "OtherDetail.aspx",
                                                        otherType.Id,
                                                        otherType.Name_VN);

                        ul.Controls.Add(subLi);
                    }

                    if (ul.Controls.Count > 0)
                    {
                        li.Controls.Add(ul);
                    }
                }

                this.ulMenuAdmin.Controls.Add(li);
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }