public override void Init()
        {
            //逻辑对象赋值
            bll = SHOP_PRICE_AREABll.GetInstence();

            ////表格对象赋值
            grid = Grid1;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //获取ID值
                hidId.Text = RequestHelper.GetInt0("Id") + "";

                //绑定下拉列表
                GROUPAREABll.GetInstence().BandDropDownList(this, txtSHOP_Area_ID);

                SHOP_PRICE_AREABll.GetInstence().BandDropDownListShowArea(this, ddlSHOP_Price_Area);
                // BranchBll.GetInstence().BandDropDownList(this, ddlParentId);

                //加载数据
                LoadData();
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //获取ID值
                hidId.Text      = RequestHelper.GetInt0("Id") + "";
                hidPROD_ID.Text = RequestHelper.GetQueryString("PROD_ID");

                //绑定下拉列表
                SHOP_PRICE_AREABll.GetInstence().BandDropDownListShowArea(this, PRCAREA_ID);

                SUPPLIERSBll.GetInstence().BandDropDownListShowSup(this, SUP_ID);

                //加载数据
                LoadData();
                if (String.IsNullOrEmpty(hidPROD_ID.Text))
                {
                    FineUI.Alert.ShowInParent("商品编码未传递,请返回商品资料界面,请重新选择商品,否则数据无法保存", FineUI.MessageBoxIcon.Information);
                }
            }
        }
        /// <summary>
        /// Grid点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
        {
            GridRow gr = Grid1.Rows[e.RowIndex];
            //获取当前点击列的主键ID
            object id = gr.DataKeys[0];


            //因为要记录修改人,修改时间跟最后更新时间,所以将单字段更新换成多字段更新
            switch (e.CommandName)
            {
            case "ENABLE":
                try
                {
                    var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("ENABLE", ConvertHelper.StringToByte(e.CommandArgument));
                    dic.Add("MOD_DATETIME", ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")));
                    dic.Add("MOD_USER_ID", OlUser.Manager_LoginName);
                    dic.Add("LAST_UPDATE", ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")));

                    SHOP_PRICE_AREABll.GetInstence().UpdateValue(this, ConvertHelper.Cint0(id), dic);
                    LoadData();
                    //PROD_KINDBll.GetInstence().Save(this, model);
                }
                catch (Exception err)
                {
                    //出现异常,保存出错日志信息
                    CommonBll.WriteLog("保存失败", err);
                }

                break;

            case "ButtonEdit":
                //打开编辑窗口
                Window1.IFrameUrl = "ShopPriceAreaEdit.aspx?Id=" + id + "&" + MenuInfoBll.GetInstence().PageUrlEncryptStringNoKey(id + "");
                Window1.Hidden    = false;

                break;
            }
        }
        public override void LoadData()
        {
            //关闭窗口
            ButtonCancel.OnClientClick = ActiveWindow.GetHideReference();
            int id = ConvertHelper.Cint0(hidId.Text);

            if (id != 0)
            {
                //获取指定ID的菜单内容,如果不存在,则创建一个菜单实体
                //缓存机制有点问题,改直接初始化数据
                var model = SHOP_PRICE_AREABll.GetInstence().GetModelForCache(x => x.Id == id);
                //var model = new PROD_UNIT(x => x.Id == id);
                if (model == null)
                {
                    return;
                }
                PRCAREA_ID.Text      = model.PRCAREA_ID;
                PRCAREA_ID.Readonly  = true;
                PRCAREA_NAME.Text    = model.PRCAREA_NAME;
                PRCAREA_MEMO.Text    = model.PRCAREA_MEMO;
                ENABLE.SelectedValue = model.ENABLE + "";
            }
        }
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;
            int    id     = ConvertHelper.Cint0(hidId.Text);

            try
            {
                #region 数据验证

                if (string.IsNullOrEmpty(PRCAREA_ID.Text.Trim()))
                {
                    return(PRCAREA_ID.Label + "不能为空!");
                }
                if (string.IsNullOrEmpty(PRCAREA_NAME.Text.Trim()))
                {
                    return(PRCAREA_NAME.Label + "不能为空!");
                }
                var sPcarea_id = StringHelper.Left(PRCAREA_ID.Text, 50);
                if (SHOP_PRICE_AREABll.GetInstence().Exist(x => x.PRCAREA_ID == sPcarea_id) && id == 0)
                {
                    return(PRCAREA_ID.Label + "已存在!请重新输入!");
                }

                var sPcarea_name = StringHelper.Left(PRCAREA_NAME.Text, 50);
                if (SHOP_PRICE_AREABll.GetInstence().Exist(x => x.PRCAREA_NAME == sPcarea_name) && id == 0)
                {
                    return(PRCAREA_NAME.Label + "已存在!请重新输入!");
                }

                //byte sEnable = ConvertHelper.StringToByte(ENABLE.SelectedValue);
                //if (sEnable == 0)
                //{
                //    return ENABLE.Label + "必须选择一个!";
                //}

                #endregion

                #region 赋值

                var model = new SHOP_PRICE_AREA(x => x.Id == id);
                //var OlUser = new OnlineUsers(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
                var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == OnlineUsersBll.GetInstence().GetUserHashKey());
                //var OlUser = OnlineUsers.SingleOrDefault(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
                model.PRCAREA_ID   = PRCAREA_ID.Text;
                model.PRCAREA_NAME = PRCAREA_NAME.Text;
                model.PRCAREA_MEMO = PRCAREA_MEMO.Text;
                model.ENABLE       = ConvertHelper.StringToByte(ENABLE.SelectedValue);
                if (id == 0)
                {
                    model.CRT_DATETIME = ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                    model.CRT_USER_ID  = OlUser.Manager_LoginName;
                }
                else
                {
                    model.CRT_DATETIME = model.CRT_DATETIME;
                    model.CRT_USER_ID  = model.CRT_USER_ID;
                }
                //model.CRT_USER_ID = "";
                model.MOD_DATETIME = ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                model.MOD_USER_ID  = OlUser.Manager_LoginName;
                //model.MOD_USER_ID = "";
                model.LAST_UPDATE = ConvertHelper.StringToDatetime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                model.STATUS      = 0;
                #endregion
                ////----------------------------------------------------------
                ////存储到数据库
                SHOP_PRICE_AREABll.GetInstence().Save(this, model);
            }
            catch (Exception e)
            {
                result = "保存失败!";

                //出现异常,保存出错日志信息
                CommonBll.WriteLog(result, e);
            }

            return(result);
        }