Example #1
0
        private void UpdateOtherProcess()
        {
            OtherBOL other = new OtherBOL()
            {
                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,
                IsGroup        = true,
                InsertDate     = DateTime.Now,
                UpdatedDate    = DateTime.Now
            };

            var result = OtherDAL.InsertOrUpdate(other);

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

                return;
            }

            StartClearData();

            Response.Redirect(Request.RawUrl, false);
        }
Example #2
0
        private void InsertOrUpdateBannerProcess()
        {
            string tag = __tag + "[InsertOrUpdateBannerProcess]";

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

            try
            {
                OtherBOL banner = new OtherBOL()
                {
                    Id             = _id > 0 ? _id : 0,
                    Name_VN        = tbxNameVN.Text,
                    Name_EN        = tbxNameEN.Text,
                    Description_VN = tbxDesVN.Text,
                    Description_EN = tbxDesEN.Text,
                    Link           = tbxLink.Text,
                    ImageLink      = UploadImageProcess(),
                    ParentId       = _catId,
                    OtherType      = _catId,
                    InsertDate     = DateTime.Now,
                    UpdatedDate    = DateTime.Now
                };

                var result = OtherDAL.InsertOrUpdate(banner);
                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;
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
Example #3
0
        private void InsertOrUpdateBannerProcess()
        {
            string tag = __tag + "[InsertOrUpdateBannerProcess]";

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

            try
            {
                OtherBOL banner = new OtherBOL()
                {
                    Name_VN        = tbxNameVN.Text,
                    Name_EN        = tbxNameEN.Text,
                    Description_VN = tbxDesVN.Text,
                    Description_EN = tbxDesEN.Text,
                    Link           = tbxLink.Text,
                    ImageLink      = UploadImageProcess(),
                    InsertDate     = DateTime.Now,
                    UpdatedDate    = DateTime.Now
                };

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

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

                lbError.InnerText = ex.Message;
                lbError.Visible   = true;
            }
            finally
            {
                LogHelpers.WriteStatus(tag, "End.");
            }
        }
Example #4
0
        public void ProcessRequest(HttpContext context)
        {
            var jsonString = string.Empty;

            context.Request.InputStream.Position = 0;

            try
            {
                var inputStream = new StreamReader(context.Request.InputStream);
                jsonString = inputStream.ReadToEnd();
                inputStream.Close();
                //--
                OtherBOL other = JsonConvert.DeserializeObject <OtherBOL>(jsonString);
                other.InsertDate  = DateTime.Now;
                other.UpdatedDate = DateTime.Now;
                other.IsGroup     = true;

                var result = OtherDAL.InsertOrUpdate(other);
                //---
                object obj = new
                {
                    Code    = result.Code,
                    Message = result.ErrorMessage,
                    Id      = result.DbReturnValue,
                    Name    = other.Name_VN
                };
                //---
                string responseString = JsonConvert.SerializeObject(obj);
                context.Response.ContentType = "application/json";
                context.Response.Write(responseString);
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }