예제 #1
0
 public override void Init()
 {
     //逻辑对象赋值
     bll = BranchBll.GetInstence();
     //表格对象赋值
     grid = Grid1;
 }
예제 #2
0
        /// <summary>读取数据</summary>
        public override void LoadData()
        {
            if (BranchTree.Nodes.Count == 0)
            {
                //创建树节点
                var tnode = new FineUI.TreeNode();
                //设置节点名称
                tnode.Text = "部门";
                //设置节点ID
                tnode.NodeID = "0";
                //设置当前节点是否为最终节点
                tnode.Leaf = false;
                //是否自动扩大
                tnode.Expanded = true;

                //根据指定的父ID去查询相关的子集ID
                var dt = BranchBll.GetInstence().GetDataTable();
                //从一级菜单开始添加
                BranchBll.GetInstence().AddNode(dt, tnode, "0");

                BranchTree.Nodes.Add(tnode);
            }

            BindGrid();
        }
        /// <summary>读取数据</summary>
        public override void LoadData()
        {
            //关闭窗口
            ButtonCancel.OnClientClick = ActiveWindow.GetHideReference();

            int id = ConvertHelper.Cint0(hidId.Text);

            if (id != 0)
            {
                //获取指定ID的菜单内容,如果不存在,则创建一个菜单实体
                var model = BranchBll.GetInstence().GetModelForCache(x => x.Id == id);
                if (model == null)
                {
                    return;
                }

                txtId.Text = model.Code;
                //对页面窗体进行赋值
                txtName.Text = model.Name;
                //设置下拉列表选择项
                ddlParentId.SelectedValue = model.ParentId + "";
                //设置页面URL
                //txtUrl.Text = model.Manager_CName;
                //设置父ID
                txtParent.Text = model.ParentId + "";
                //设置排序
                txtSort.Text = model.Sort + "";
                //设置页面类型——菜单还是页面
                // rblIsMenu.SelectedValue = model.IsMenu + "";
                //设置是否显示
                //  rblIsDisplay.SelectedValue = model.IsDisplay + "";
            }
        }
예제 #4
0
        /// <summary>读取数据</summary>
        public override void LoadData()
        {
            int id = ConvertHelper.Cint0(hidId.Text);

            if (id != 0)
            {
                //获取指定ID的部门内容
                var model = BranchBll.GetInstence().GetModelForCache(x => x.Id == id);
                if (model == null)
                {
                    return;
                }

                //对页面窗体进行赋值
                txtName.Text = model.Name;
                //设置下拉列表选择项
                ddlParentId.SelectedValue = model.ParentId + "";
                //编辑时不给改变上级部门
                ddlParentId.Enabled = false;
                //设置部门编码
                txtCode.Text = model.Code;
                //设置父ID
                txtParent.Text = model.ParentId + "";
                //设置排序
                txtSort.Text = model.Sort + "";
                //设置注备
                txtNotes.Text = model.Notes;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //检测用户是否超时退出
            OnlineUsersBll.GetInstence().IsTimeOut();
            //检测用户登录的有效性(是否被系统踢下线或管理员踢下线)
            if (OnlineUsersBll.GetInstence().IsOffline(this))
            {
                return;
            }
            //检查是否从正确路径进入
            MenuInfoBll.GetInstence().CheckPageEncrypt(this);

            if (!IsPostBack)
            {
                //获取ID值
                hidPositionId.Text = RequestHelper.GetQueryString("Id");
                //新增用户时生成的Id是随机码,这里处理一下
                if (hidPositionId.Text.IndexOf(",") == -1)
                {
                    hidPositionId.Text = "";
                }
                //绑定下接列表
                BranchBll.GetInstence().BandDropDownListShowAll(this, ddlBranch, true);

                LoadData();
            }
        }
예제 #6
0
        /// <summary>读取数据</summary>
        public override void LoadData()
        {
            int positionId = ConvertHelper.Cint0(hidPositionId.Text);

            if (positionId != 0)
            {
                //获取指定ID的职位内容
                var model = PositionBll.GetInstence().GetModelForCache(x => x.Id == positionId);
                if (model == null)
                {
                    return;
                }

                //对页面窗体进行赋值
                txtName.Text = model.Name;
                //设置下拉列表选择项
                labBranchName.Text = model.Branch_Name;
                //设置页面权限
                _pagePower = model.PagePower;
                //设置页面控件权限
                _controlPower = model.ControlPower;
            }
            else
            {
                //设置部门
                var branchModel = BranchBll.GetInstence().GetModelForCache(ConvertHelper.Cint0(hidBranchId.Text));
                labBranchName.Text = branchModel.Name;
            }

            //创建树节点
            var tnode = new FineUI.TreeNode();

            //设置节点名称
            tnode.Text = "菜单";
            //设置节点ID
            tnode.NodeID = "0";
            //设置当前节点是否为最终节点
            tnode.Leaf = false;
            //是否可以选择(打勾)
            tnode.EnableCheckBox = true;
            //是否已经选择
            tnode.Checked = true;
            //是否自动扩大
            tnode.Expanded = true;
            //开启点击节点全选或取消事件
            tnode.EnableCheckEvent = true;

            //根据指定的父ID去查询相关的子集ID
            var dt = MenuInfoBll.GetInstence().GetDataTable();
            //获取全部页面权限
            var pgdt = PagePowerSignBll.GetInstence().GetDataTable();

            //从一级菜单开始添加
            AddNode(dt, pgdt, tnode, "0");

            MenuTree.Nodes.Add(tnode);
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //绑定部门
                BranchBll.GetInstence().BandDropDownListShowAll(this, ddlBranch_Id, true);

                LoadData();
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //绑定下拉列表
                BranchBll.GetInstence().BandDropDownList(this, ddlParentId);

                LoadData();
            }
        }
예제 #9
0
        /// <summary>读取数据</summary>
        public override void LoadData()
        {
            string shop_id   = SHOP_hidId.Text.Trim();
            int    managerId = OnlineUsersBll.GetInstence().GetManagerId();//获取登录名

            //表头
            SHOP00Bll.GetInstence().BandDropDownListShowShop(this, ddlShop, shop_id); //分店名称

            SHOP00Bll.GetInstence().BandDropDownListShowShop1(this, ddlOUT_SHOP);     //供货分店
            // ORDER_DEP00Bll.GetInstence().BandDropDownList(this, ddlORDER_DEP, shop_id);//订货部门
            BranchBll.GetInstence().BandDropDownList(this, ddlORDER_DEP);

            HiddenDep_Id.Text = ddlORDER_DEP.SelectedValue;

            string manager_LoginName = OnlineUsersBll.GetInstence().GetUserOnlineInfo("Manager_LoginName").ToString();//登录名

            txtCRT_USER_ID.Text = manager_LoginName;
            txtORD_USER.Text    = manager_LoginName;
            txtAPP_USER.Text    = manager_LoginName;
            txtMOD_USER_ID.Text = manager_LoginName;

            txtINPUT_DATE.SelectedDate = DateTime.Now; //单据时间
            txtManage.Text             = manager_LoginName;


            ddlStatus.SelectedValue = "0";//状态

            ddlEXPECT_DATE.SelectedDate  = DateTime.Now.AddDays(1);
            txtCRT_DATETIME.SelectedDate = DateTime.Now;
            txtMOD_DATETIME.SelectedDate = DateTime.Now;


            txtEXPORTED_ID.Text = "";

            txtMemo.Text = "";

            cbTrans_STATUS.Checked = false;

            DataTable table = GetSourceData("", "");

            Grid1.DataSource = table;
            Grid1.DataBind();

            ///grid2
            // string shop_id = OnlineUsersBll.GetInstence().GetUserOnlineInfo("SHOP_ID").ToString();
            // conditionList = new List<ConditionFun.SqlqueryCondition>();
            // conditionList.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, ORDER00Table.SHOP_ID, Comparison.Equals, shop_id, false, false));

            //  ORDER00Bll.GetInstence().BindGrid(Grid2, 0, sortList);
            // bll.BindGrid(Grid2, 0, sortList);
            //  ORDER00Bll.GetInstence().BindGrid(Grid2, 0, 0, conditionList, sortList);
            //------------------
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //获取ID值
                hidId.Text = RequestHelper.GetInt0("Id") + "";

                //绑定下拉列表
                BranchBll.GetInstence().BandDropDownList(this, ddlParentId);

                //加载数据
                LoadData();
            }
        }
예제 #11
0
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <returns></returns>
        public override string Delete()
        {
            //获取要删除的ID
            int id = ConvertHelper.Cint0(GridViewHelper.GetSelectedKey(Grid1, true));

            //如果没有选择记录,则直接退出
            if (id == 0)
            {
                return("请选择要删除的记录。");
            }

            try
            {
                //删除前判断一下
                if (BranchBll.GetInstence().Exist(x => x.ParentId == id))
                {
                    return("删除失败,本部门下面存在子部门,不能直接删除!");
                }
                //删除前判断一下
                if (PositionBll.GetInstence().Exist(x => x.Branch_Id == id))
                {
                    return("删除失败,相关职位已绑定本部门,不能直接删除!");
                }
                if (ManagerBll.GetInstence().Exist(x => x.Branch_Id == id))
                {
                    return("删除失败,已有员工绑定本部门,不能直接删除!");
                }

                //删除记录
                bll.Delete(this, id);

                return("删除编号ID为[" + id + "]的数据记录成功。");
            }
            catch (Exception e)
            {
                string result = "尝试删除编号ID为[" + id + "]的数据记录失败!";

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

                return(result);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //获取ID值
                hidId.Text = RequestHelper.GetInt0("Id") + "";

                SHOP00Bll.GetInstence().BandDropDownListShowShop1(this, SHOPdll);

                //绑定下拉列表 部门
                BranchBll.GetInstence().BandDropDownList(this, Brachddl);

                //绑定下拉列表 职位
                PositionBll.GetInstence().BandDropDownList(this, Positionddl);


                //加载数据
                LoadData();
            }
        }
        /// <summary>
        /// 加载下拉列表
        /// </summary>
        public void LoadList()
        {
            PROD_KINDBll.GetInstence().BandDropDownListShowKind(this, cPROD_KIND);
            PROD_DEPBll.GetInstence().BandDropDownListShowDep(this, cPROD_DEP);
            PROD_CateBll.GetInstence().BandDropDownListShowCate(this, cPROD_CATE);
            //隶属部门
            BranchBll.GetInstence().BandDropDownListShowMenu(this, cDIV_ID);

            //绑定下拉列表
            PROD_KINDBll.GetInstence().BandDropDownListShowKind(this, PROD_KIND);
            PROD_DEPBll.GetInstence().BandDropDownListShowDep(this, PROD_DEP);
            PROD_CateBll.GetInstence().BandDropDownListShowCate(this, PROD_CATE);
            //隶属部门
            BranchBll.GetInstence().BandDropDownListShowMenu(this, DIV_ID);
            //单位
            PROD_UNITBll.GetInstence().BandDropDownListShowUnit(this, PROD_UNIT);
            PROD_UNITBll.GetInstence().BandDropDownListShowUnit(this, PROD_UNIT1);
            PROD_UNITBll.GetInstence().BandDropDownListShowUnit(this, PROD_UNIT2);

            SUPPLIERSBll.GetInstence().BandDropDownListShowSup(this, ddlSUPID);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //获取ID值
                hidId.Text = RequestHelper.GetInt0("Id") + "";

                //绑定下拉列表
                PROD_KINDBll.GetInstence().BandDropDownListShowKind(this, PROD_KIND);
                PROD_DEPBll.GetInstence().BandDropDownListShowDep(this, PROD_DEP);
                PROD_CateBll.GetInstence().BandDropDownListShowCate(this, PROD_CATE);
                //隶属部门
                BranchBll.GetInstence().BandDropDownListShowMenu(this, DIV_ID);
                //单位
                PROD_UNITBll.GetInstence().BandDropDownListShowUnit(this, PROD_UNIT);
                PROD_UNITBll.GetInstence().BandDropDownListShowUnit(this, PROD_UNIT1);
                PROD_UNITBll.GetInstence().BandDropDownListShowUnit(this, PROD_UNIT2);
                //加载数据
                LoadData();
            }
        }
 /// <summary>下拉列表改变事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ddlParentId_SelectedIndexChanged(object sender, EventArgs e)
 {
     //初始化路径值
     // txtUrl.Text = string.Empty;
     //获取当前节点的父节点Id
     txtParent.Text = ddlParentId.SelectedValue;
     if (!ddlParentId.SelectedValue.Equals("1"))
     {
         try
         {
             //获取当前节点的父节点url
             // txtUrl.Text = BranchBll.GetInstence().GetFieldValue(ConvertHelper.Cint0(ddlParentId.SelectedValue), MenuInfoTable.Url) + "";
             txtId.Text     = BranchBll.GetInstence().GetFieldValue(ConvertHelper.Cint0(ddlParentId.SelectedValue), BranchTable.Code) + "";
             txtParent.Text = BranchBll.GetInstence().GetFieldValue(ConvertHelper.Cint0(ddlParentId.SelectedValue), BranchTable.ParentId) + "";
             txtSort.Text   = BranchBll.GetInstence().GetFieldValue(ConvertHelper.Cint0(ddlParentId.SelectedValue), BranchTable.Sort) + "";
         }
         catch
         {
         }
     }
 }
예제 #16
0
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;
            int    id     = ConvertHelper.Cint0(hidId.Text);

            try
            {
                #region 数据验证

                if (string.IsNullOrEmpty(txtLoginName.Text.Trim()))
                {
                    return(txtLoginName.Label + "不能为空!");
                }
                var logName = StringHelper.Left(txtLoginName.Text, 20);
                if (Manager.Exists(x => x.LoginName == logName && x.Id != id))
                {
                    return(txtLoginName.Label + "已存在!请重新输入!");
                }

                //新增用户时,密码不能为空
                if (id == 0 && string.IsNullOrEmpty(txtLoginPass.Text.Trim()))
                {
                    return("密码不能为空!");
                }
                //密码长度不能短于6位
                if (!string.IsNullOrEmpty(txtLoginPass.Text.Trim()) && txtLoginPass.Text.Trim().Length < 6)
                {
                    return("密码长度必须6位以上,请重新输入!");
                }
                if (!txtLoginPass.Text.Equals(txtLoginPassaAgin.Text))
                {
                    return("两次输入的密码不一样,请重新输入!");
                }

                if (string.IsNullOrEmpty(txtCName.Text.Trim()))
                {
                    return(txtCName.Label + "不能为空!");
                }
                //所属部门
                if (ConvertHelper.Cint0(ddlBranch_Id.SelectedValue) < 1)
                {
                    return(ddlBranch_Id.Label + "为必选项,请选择!");
                }
                //所属职位
                if (string.IsNullOrEmpty(hidPositionId.Text))
                {
                    return(txtPosition.Label + "为必选项,请选择!");
                }
                #endregion

                #region 赋值
                //获取实体
                var model = new Manager(x => x.Id == id);
                model.LoginName = logName;

                //如果是添加管理员
                if (id == 0)
                {
                    model.CreateTime    = DateTime.Now;
                    model.UpdateTime    = DateTime.Now;
                    model.Manager_Id    = OnlineUsersBll.GetInstence().GetManagerId();
                    model.Manager_CName = OnlineUsersBll.GetInstence().GetManagerCName();
                    model.LoginPass     = Encrypt.Md5(Encrypt.Md5(txtLoginPass.Text));
                    model.IsWork        = 1;
                }
                else
                {
                    //修改时间与管理员
                    model.UpdateTime    = DateTime.Now;
                    model.Manager_Id    = OnlineUsersBll.GetInstence().GetManagerId();
                    model.Manager_CName = OnlineUsersBll.GetInstence().GetManagerCName();

                    //修改用户时,填写了密码,则更新密码
                    if (txtLoginPass.Text.Trim().Length >= 6)
                    {
                        model.LoginPass = Encrypt.Md5(Encrypt.Md5(txtLoginPass.Text));
                    }
                }
                model.Branch_Id = ConvertHelper.Cint0(ddlBranch_Id.SelectedValue);
                var branch = BranchBll.GetInstence().GetModelForCache(x => x.Id == model.Branch_Id);
                if (branch != null)
                {
                    model.Branch_Code = branch.Code;
                    model.Branch_Name = branch.Name;
                }

                model.Position_Id   = StringHelper.Left(hidPositionId.Text, 100);
                model.Position_Name = StringHelper.Left(txtPosition.Text, 500);

                model.CName             = StringHelper.Left(txtCName.Text, 20);
                model.EName             = StringHelper.Left(txtEName.Text, 50);
                model.Sex               = StringHelper.Left(rblSex.SelectedValue, 4);
                model.Birthday          = StringHelper.Left(dpBirthday.Text, 20);
                model.Record            = StringHelper.Left(txtRecord.Text, 25);
                model.GraduateCollege   = StringHelper.Left(txtGraduateCollege.Text, 30);
                model.GraduateSpecialty = StringHelper.Left(txtGraduateSpecialty.Text, 50);
                model.Tel               = StringHelper.Left(txtTel.Text, 30);
                model.Mobile            = StringHelper.Left(txtMobile.Text, 30);
                model.Email             = StringHelper.Left(txtEmail.Text, 50);
                model.Qq           = StringHelper.Left(txtQq.Text, 30);
                model.Msn          = StringHelper.Left(txtMsn.Text, 30);
                model.Address      = StringHelper.Left(txtAddress.Text, 100);
                model.IsEnable     = ConvertHelper.Ctinyint(rblIsEnable.SelectedValue);
                model.IsMultiUser  = ConvertHelper.Ctinyint(rblIsMultiUser.SelectedValue);
                model.Content      = StringHelper.Left(txtContent.Text, 0);
                model.NationalName = StringHelper.Left(txtNationalName.Text, 50);
                model.NativePlace  = StringHelper.Left(txtNativePlace.Text, 100);

                #region   图片
                if (this.fuSinger_AvatarPath.HasFile && this.fuSinger_AvatarPath.FileName.Length > 3)
                {
                    int vid = 1;   //1	管理员头像(头像图片)
                    //---------------------------------------------------
                    var upload = new UploadFile();
                    result = new UploadFileBll().Upload_AspNet(this.fuSinger_AvatarPath.PostedFile, vid, RndKey, OnlineUsersBll.GetInstence().GetManagerId(), OnlineUsersBll.GetInstence().GetManagerCName(), upload);
                    this.fuSinger_AvatarPath.Dispose();
                    //---------------------------------------------------
                    if (result.Length == 0)//上传成功
                    {
                        model.PhotoImg = upload.Path;
                    }
                    else
                    {
                        CommonBll.WriteLog("上传管理员头像图片未成功:" + result, null);//收集异常信息
                        return("上传管理员头像图片未成功!" + result);
                    }
                }
                //如果是修改,检查用户是否重新上传过封面图片,如果是删除旧的图片
                if (model.Id > 0)
                {
                    UploadFileBll.GetInstence().Upload_DiffFile(ManagerTable.Id, ManagerTable.PhotoImg, ManagerTable.TableName, model.Id, model.PhotoImg);

                    //同步UploadFile上传表
                    UploadFileBll.GetInstence().Upload_UpdateRs(RndKey, ManagerTable.TableName, model.Id);
                }
                #endregion



                #endregion

                //----------------------------------------------------------
                //存储到数据库
                ManagerBll.GetInstence().Save(this, model);

                #region  步更新上传图片表绑定Id
                if (id == 0)
                {
                    //同步UploadFile上传表记录,绑定刚刚上传成功的文件Id为当前记录Id
                    UploadFileBll.GetInstence().Upload_UpdateRs(RndKey, ManagerTable.TableName, model.Id);
                }

                #endregion
            }
            catch (Exception e)
            {
                result = "保存失败!";

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

            return(result);
        }
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;
            int    id     = ConvertHelper.Cint0(hidId.Text);

            try
            {
                #region 数据验证

                if (string.IsNullOrEmpty(txtLoginName.Text.Trim()))
                {
                    return(txtLoginName.Label + "不能为空!");
                }

                if (SHOPdll.SelectedText.Trim() == "请选择分店")
                {
                    return(SHOPdll.Label + "不能为空!");
                }

                var sName = StringHelper.Left(txtLoginName.Text, 50);
                if (ManagerBll.GetInstence().Exist(x => x.LoginName == sName && x.Id != id))
                {
                    return(txtLoginName.Label + "已存在!请重新输入!");
                }

                if (string.IsNullOrEmpty(txtPwd.Text.Trim()))
                {
                    return(txtPwd.Label + "不能为空!");
                }


                #endregion

                #region 赋值
                //读取指定部门资料
                var model = new Manager(x => x.Id == id);

                model.LoginName  = txtLoginName.Text;
                model.LoginPass  = model.LoginPass == txtPwd.Text.Trim()?model.LoginPass: Encrypt.Md5(Encrypt.Md5(txtPwd.Text));//:model.LoginPass;  model.LoginPass == null?
                model.LoginTime  = DateTime.Now;
                model.LoginIp    = "1::";
                model.LoginCount = 1;
                model.CreateTime = DateTime.Now;
                model.UpdateTime = DateTime.Now;

                int branch_id = ConvertHelper.Cint0(Brachddl.SelectedValue);

                var model_b = BranchBll.GetInstence().GetModelForCache(x => x.Id == branch_id);

                model.Branch_Id   = model_b.Id;
                model.Branch_Code = model_b.Code;
                model.Branch_Name = model_b.Name;

                model.IsMultiUser = ConvertHelper.StringToByte(rblIsMultiUser.SelectedValue.ToString());
                model.IsWork      = ConvertHelper.StringToByte(rblIsWork.SelectedValue);
                model.IsEnable    = ConvertHelper.StringToByte(rblIsEnable.SelectedValue);

                var model_p = PositionBll.GetInstence().GetModelForCache(x => x.Id == ConvertHelper.Cint0(Positionddl.SelectedValue));

                model.Position_Id   = model_p.Id.ToString();
                model.Position_Name = model_p.Name;


                model.CName    = txtCName.Text;
                model.EName    = txtEName.Text;
                model.Sex      = rblSex.SelectedValue.ToString();
                model.PhotoImg = "";
                model.Birthday = Birthday.SelectedDate.ToString();

                model.NativePlace       = txtNativePlace.Text;
                model.NationalName      = txtNationalName.Text;
                model.Record            = txtRecord.Text;
                model.GraduateCollege   = txtGraduateCollege.Text;
                model.GraduateSpecialty = txtGraduateSpecialty.Text;
                model.Tel           = txtTel.Text;
                model.Tel           = txtMobile.Text;
                model.Email         = txtEmail.Text;
                model.Qq            = txtQq.Text;
                model.Msn           = "";
                model.Address       = txtAddress.Text;
                model.Content       = txtContent.Text;
                model.Manager_Id    = OnlineUsersBll.GetInstence().GetManagerId();
                model.Manager_CName = OnlineUsersBll.GetInstence().GetManagerCName();

                model.SHOP_ID    = SHOPdll.SelectedValue;
                model.SHOP_NAME1 = SHOPdll.SelectedText;

                #endregion

                //----------------------------------------------------------
                //存储到数据库
                ManagerBll.GetInstence().Save(this, model);
            }
            catch (Exception e)
            {
                result = "保存失败!";

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

            return(result);
        }
예제 #18
0
        public override void Add()
        {
            string shop_id   = OnlineUsersBll.GetInstence().GetUserOnlineInfo("SHOP_ID").ToString(); // SHOP_hidId.Text.Trim();
            int    managerId = OnlineUsersBll.GetInstence().GetManagerId();                          //获取登录名

            //表头
            SHOP00Bll.GetInstence().GetShopList(this, shop_id, ddlShop);          //.BandDropDownListShowShop(this, ddlShop, shop_id); //分店名称

            SHOP00Bll.GetInstence().BandDropDownListShowShop1(this, ddlOUT_SHOP); //供货分店
                                                                                  // ORDER_DEP00Bll.GetInstence().BandDropDownList(this, ddlORDER_DEP, shop_id);//订货部门
            BranchBll.GetInstence().BandDropDownList(this, ddlORDER_DEP);

            string manager_LoginName = OnlineUsersBll.GetInstence().GetUserOnlineInfo("Manager_LoginName").ToString();//登录名

            txtCRT_USER_ID.Text = manager_LoginName;
            txtORD_USER.Text    = manager_LoginName;
            txtAPP_USER.Text    = "";                  // manager_LoginName;
            txtMOD_USER_ID.Text = "";                  // manager_LoginName;

            txtINPUT_DATE.SelectedDate = DateTime.Now; //单据时间
            txtManage.Text             = manager_LoginName;

            ddlStatus.SelectedValue      = "0";//状态
            ddlEXPECT_DATE.SelectedDate  = DateTime.Now.AddDays(1);
            txtCRT_DATETIME.SelectedDate = DateTime.Now;
            txtMOD_DATETIME.SelectedDate = DateTime.Now;

            txtEXPORTED_ID.Text = "";

            txtMemo.Text = "";

            cbTrans_STATUS.Checked = false;

            ddlShop.SelectedValue = shop_id;

            HiddenShop_Id.Text = ddlShop.SelectedValue;// ddlORDER_DEP.SelectedValue;

            Random ran = new Random();

            txtORDER_ID.Text        = ddlShop.SelectedValue + "OR" + DateTime.Now.ToString("yyyy-MM-dd").Replace("-", "") + ran.Next(1000, 9999);
            ddlStatus.SelectedIndex = 0;

            txtEXPORTED_ID.Text = "";
            txtEXPORTED.Checked = false;

            txtCRT_DATETIME.Text = DateTime.Now.ToString();

            txtLAST_UPDATE.Text  = DateTime.Now.ToString();
            txtMOD_DATETIME.Text = DateTime.Now.ToString();

            //设置不可更改
            txtINPUT_DATE.Enabled  = true;
            ddlEXPECT_DATE.Enabled = true;
            ddlORDER_DEP.Enabled   = true;
            ddlORD_TYPE.Enabled    = true;
            ddlEXPECT_DATE.Enabled = true;
            ddlOUT_SHOP.Enabled    = true;
            txtMemo.Enabled        = true;
            ButtonApproval.Enabled = true;

            btnNew.Enabled    = true;
            btnDelete.Enabled = true;
            Grid1.Enabled     = true;
            Grid1.Rows.Clear();

            //  txtManage.Text = OnlineUsersBll.GetInstence().GetManager_LoginName(this, managerId, true);
        }
예제 #19
0
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;
            int    id     = ConvertHelper.Cint0(hidId.Text);

            try
            {
                #region 数据验证

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

                #endregion

                #region 赋值
                //定义是否更新其他关联表变量
                bool isUpdate = false;

                //获取实体
                var model = new Branch(x => x.Id == id);

                //判断是否有改变名称
                if (id > 0 && sName != model.Name)
                {
                    isUpdate = true;
                }

                //修改时间与管理员
                model.UpdateDate    = DateTime.Now;
                model.Manager_Id    = OnlineUsersBll.GetInstence().GetManagerId();
                model.Manager_CName = OnlineUsersBll.GetInstence().GetManagerCName();

                //设置名称
                model.Name = sName;
                //对应的父类id
                model.ParentId = ConvertHelper.Cint0(txtParent.Text);
                //设置备注
                model.Notes = StringHelper.Left(txtNotes.Text, 100);

                //由于限制了编辑时不能修改父节点,所以这里只对新建记录时处理
                if (id == 0)
                {
                    //设定当前的深度与设定当前的层数级
                    if (model.ParentId == 0)
                    {
                        //设定当前的层数
                        model.Depth = 0;
                    }
                    else
                    {
                        //设定当前的层数级
                        model.Depth = ConvertHelper.Cint0(BranchBll.GetInstence().GetFieldValue(ConvertHelper.Cint0(ddlParentId.SelectedValue), BranchTable.Depth)) + 1;
                    }
                }

                //设置排序
                if (txtSort.Text == "0")
                {
                    model.Sort = BranchBll.GetInstence().GetSortMax(model.ParentId) + 1;
                }
                else
                {
                    model.Sort = ConvertHelper.Cint0(txtSort.Text);
                }

                //新创建部门时,生成对应的部门编码
                if (id == 0)
                {
                    model.Code = SPs.P_Branch_GetMaxBranchCode(model.Depth + 1, model.ParentId).ExecuteScalar().ToString();
                }

                #endregion

                //----------------------------------------------------------
                //存储到数据库
                BranchBll.GetInstence().Save(this, model);

                //如果本次修改改变了相关名称,则同步更新其他关联表的对应名称
                if (isUpdate)
                {
                    PositionBll.GetInstence().UpdateValue_For_Branch_Id(this, model.Id, PositionTable.Branch_Name, model.Name);
                    ManagerBll.GetInstence().UpdateValue_For_Branch_Id(this, model.Id, ManagerTable.Branch_Name, model.Name);
                }
            }
            catch (Exception e)
            {
                result = "保存失败!";

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

            return(result);
        }
예제 #20
0
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result     = string.Empty;
            var    branchId   = ConvertHelper.Cint0(hidBranchId.Text);
            var    positionId = ConvertHelper.Cint0(hidPositionId.Text);

            try
            {
                #region 数据验证

                if (branchId == 0)
                {
                    return("非法路径进入!");
                }

                if (string.IsNullOrEmpty(txtName.Text.Trim()))
                {
                    return(txtName.Label + "不能为空!");
                }
                //同一个部门里职位不能样同,不同部门可以有同名称的职位
                var sName = StringHelper.Left(txtName.Text, 30);
                if (PositionBll.GetInstence().Exist(x => x.Branch_Id == branchId && x.Name == sName && x.Id != positionId))
                {
                    return(txtName.Label + "已存在!请重新输入!");
                }
                #endregion

                #region 赋值
                //定义是否更新其他关联表变量
                bool isUpdate = false;

                //获取实体
                var model = new Position(x => x.Id == positionId);

                //判断是否有改变名称
                if (positionId > 0 && sName != model.Name)
                {
                    isUpdate = true;
                }

                //修改时间与管理员
                model.UpdateDate    = DateTime.Now;
                model.Manager_Id    = OnlineUsersBll.GetInstence().GetManagerId();
                model.Manager_CName = OnlineUsersBll.GetInstence().GetManagerCName();

                //设置名称
                model.Name = sName;

                //设置部门
                var branchModel = BranchBll.GetInstence().GetModelForCache(branchId);
                model.Branch_Id   = branchId;
                model.Branch_Name = branchModel.Name;
                model.Branch_Code = branchModel.Code;

                //设置职位权限
                //从树列表中获取勾选的节点
                GetCheckTreeNode(MenuTree.Nodes);
                //赋予权限
                model.PagePower    = StringHelper.FilterSql(_hidPositionPagePower);
                model.ControlPower = StringHelper.FilterSql(_hidPositionControlPower);

                #endregion

                //----------------------------------------------------------
                //存储到数据库
                PositionBll.GetInstence().Save(this, model);

                //如果本次修改改变了相关名称,则同步更新其他关联表的对应名称
                if (isUpdate)
                {
                    ManagerBll.GetInstence().UpdatePositionName(model.Id, model.Name);
                }
            }
            catch (Exception e)
            {
                result = "保存失败!";

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

            return(result);
        }
예제 #21
0
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;
            int    id     = ConvertHelper.Cint0(hidId.Text);

            try
            {
                #region 数据验证

                if (string.IsNullOrEmpty(txtName.Text.Trim()))
                {
                    return(txtName.Label + "不能为空!");
                }
                var sName = StringHelper.Left(txtName.Text, 50);
                if (BranchBll.GetInstence().Exist(x => x.Name == sName && x.Id != id))
                {
                    return(txtName.Label + "已存在!请重新输入!");
                }
                if (string.IsNullOrEmpty(txtId.Text.Trim()))
                {
                    return(txtId.Label + "不能为空!");
                }
                //var sUrl = StringHelper.Left(txtUrl.Text, 400);
                //if (BranchBll.GetInstence().Exist(x => x.Url == sUrl && x.Id != id))
                //{
                //    return txtUrl.Label + "已存在!请重新输入!";
                //}

                #endregion

                #region 赋值
                //读取指定部门资料
                //  var model = new Branch(x => x.Id == id);

                //model.Code = txtId.Text;
                ////设置名称
                //model.Name = sName;
                ////连接地址
                //// model.Url = sUrl;
                ////对应的父类id
                //model.ParentId = ConvertHelper.Cint0(txtParent.Text);

                ////设定当前的深度与设定当前的层数级
                //if (model.ParentId == 0)
                //{
                //    //设定当前的层数级
                //    model.Depth = 0;
                //}
                //else
                //{
                //    try
                //    {
                //        //设定当前的层数级
                //        model.Depth = ConvertHelper.Cint0(BranchBll.GetInstence().GetFieldValue(ConvertHelper.Cint0(ddlParentId.SelectedValue), MenuInfoTable.Depth)) + 1;
                //    }
                //    catch
                //    {
                //        model.Depth = 0;
                //    }
                //}

                //设置排序
                if (txtSort.Text == "0")
                {
                    //model.Sort = ConvertHelper.Cint0(SPs.P_All_GetOrderId(MenuInfoTable.TableName, MenuInfoTable.ParentId, model.ParentId.ToString(), MenuInfoTable.Sort).ExecuteScalar()) + 1;
                }
                else
                {
                    //  model.Sort = ConvertHelper.Cint0(txtSort.Text);
                }
                //设定当前项属于菜单还是页面
                // model.IsMenu = ConvertHelper.StringToByte(rblIsMenu.SelectedValue);
                //设定当前项是否显示
                //  model.IsDisplay = ConvertHelper.StringToByte(rblIsDisplay.SelectedValue);
                #endregion

                //----------------------------------------------------------
                //存储到数据库
                //  BranchBll.GetInstence().Save(this, model);
            }
            catch (Exception e)
            {
                result = "保存失败!";

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

            return(result);
        }