コード例 #1
0
        private void StartDeleteItemsProcessing(string listId)
        {
            try
            {
                var result = OtherTypeDAL.DeleteAll(listId);
                if (result.Code < 0)
                {
                    lbError.InnerText = result.ErrorMessage;
                    lbError.Visible   = true;

                    return;
                }

                if (result.Data != null &&
                    result.Data.Tables.Count > 0 &&
                    result.Data.Tables[0].Rows.Count > 0)
                {
                    StartShowDeleteMessageErrors(result.Data.Tables[0]);
                }

                lbError.Visible = false;
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException("[ucMenuItems][StartDeleteItemsProcessing]", ex.ToString());
                //---
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
        }
コード例 #2
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.");
            }
        }
コード例 #3
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.");
            }
        }
コード例 #4
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.");
            }
        }
コード例 #5
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.");
            }
        }
コード例 #6
0
ファイル: ucOtherInfo.ascx.cs プロジェクト: tnhhcmus/Projects
        private void StartLoadOtherInfo(int id)
        {
            string tag = __tag + "[StartLoadOtherInfo]";

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

            lbError.Visible = false;

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

                OtherTypeBOL otherType = new OtherTypeBOL(result.Data.Tables[0].Rows[0]);
                hfId.Value     = otherType.Id.ToString();
                tbxNameVN.Text = otherType.Name_VN;
                tbxNameEN.Text = otherType.Name_EN;
                tbxDesVN.Text  = otherType.Description_VN;
                tbxDesEN.Text  = otherType.Description_EN;

                if (otherType.Name_VN == "Banner")
                {
                    tbxNameEN.Enabled = false;
                    tbxNameVN.Enabled = false;
                }
                else
                {
                    tbxNameVN.Enabled = true;
                    tbxNameEN.Enabled = true;
                }
                //---
                btnSubmit.Text    = "Update";
                btnCancel.Visible = true;
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
コード例 #7
0
ファイル: ucOtherInfo.ascx.cs プロジェクト: tnhhcmus/Projects
        private void InsertOrUpdateBannerProcess()
        {
            string tag = __tag + "[InsertOrUpdateBannerProcess]";

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

            try
            {
                if (tbxNameVN.Enabled)
                {
                    UpdateOtherProcess();
                    return;
                }

                OtherTypeBOL other = new OtherTypeBOL()
                {
                    Id             = string.IsNullOrEmpty(hfId.Value) ? 0 : int.Parse(hfId.Value),
                    Name_VN        = tbxNameVN.Text,
                    Name_EN        = tbxNameEN.Text,
                    Description_VN = tbxDesVN.Text,
                    Description_EN = tbxDesEN.Text,
                    InsertDate     = DateTime.Now,
                    UpdatedDate    = DateTime.Now
                };

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

                    return;
                }

                StartClearData();

                Response.Redirect(Request.RawUrl, false);
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());

                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
        }
コード例 #8
0
ファイル: ucOtherInfo.ascx.cs プロジェクト: tnhhcmus/Projects
        private void StartLoadOtherInfo(int id)
        {
            string tag = __tag + "[StartLoadOtherInfo]";

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

            formSubMenu.Visible = false;
            lbError.Visible     = false;

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

                OtherTypeBOL otherType = new OtherTypeBOL(result.Data.Tables[0].Rows[0]);
                hfId.Value     = otherType.Id.ToString();
                tbxNameVN.Text = otherType.Name_VN;
                tbxNameEN.Text = otherType.Name_EN;
                tbxDesVN.Text  = otherType.Description_VN;
                tbxDesEN.Text  = otherType.Description_EN;
                btnAddSubMenu.Attributes.Add("data-id", otherType.Id.ToString());

                if (!otherType.Name_VN.Contains("Banner"))
                {
                    formSubMenu.Visible = true;
                }

                tbxNameEN.Enabled = false;
                tbxNameVN.Enabled = false;

                //---
                //btnSubmit.Text = "Update";
                //btnCancel.Visible = true;
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
        }
コード例 #9
0
        public void ProcessRequest(HttpContext context)
        {
            string tag = "[SortOtherTypeHandler][ProcessRequest]";

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

            context.Request.InputStream.Position = 0;
            object result;

            try
            {
                var    inputStream = new StreamReader(context.Request.InputStream);
                string receiveJson = inputStream.ReadToEnd();

                OtherTypeUpdateIndexBOL[] receiveData = JsonConvert.DeserializeObject <OtherTypeUpdateIndexBOL[]>(receiveJson);
                var updateResult = OtherTypeDAL.UpdateIndex(receiveData);

                result = new
                {
                    Code    = updateResult.Code,
                    Message = updateResult.ErrorMessage
                };
            }
            catch (Exception ex)
            {
                LogHelpers.WriteException(tag, ex.ToString());
                //--
                result = new
                {
                    Code    = ex.HResult,
                    Message = ex.Message
                };
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }

            string responseString = JsonConvert.SerializeObject(result);

            context.Response.ContentType = "application/json";
            context.Response.Write(responseString);
        }