Пример #1
0
        bool AddDept()
        {
            string strDeptID = "";

            if (txtDeptName.Text.Length == 0)
            {
                alertControl.Enable = true;
                alertControl.Msg    = "请输入部门名称";
                return(false);
            }
            try
            {
                //Dept getDept = new Dept();
                //getDept.cnvcDeptID = this.hidParentID.Value;

                //Dept deptParent = DeptFacade.GetDept(getDept);//BaseSqlMapDao.ExecuteQueryForObject("Dept.Select",this.hidParentID.Value) as ynhnOilManage.Common.Dept;


                DataTable dtCount = ReportQueryFacade.CommonQuery("select * from tbDept where cnvcDeptName = '" + this.txtDeptName.Text + "'");
                if (dtCount.Rows.Count > 0)
                {
                    throw new Exception("同名部门已存在,请添加新部门!");
                }
                strDeptID = DeptFacade.GetDeptID(this.hidParentID.Value);
                Dept dept = new Dept();
                dept.cnvcDeptID       = strDeptID;
                dept.cnvcParentDeptID = this.hidParentID.Value;
                dept.cnbValidate      = this.chkValidate.Checked;
                dept.cnvcDeptName     = this.txtDeptName.Text;


                Dept    curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
                Oper    curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
                BusiLog busiLog = new BusiLog();
                busiLog.cndOperDate  = DateTime.Now;
                busiLog.cnnSerial    = Guid.NewGuid();
                busiLog.cnvcOperName = curOper.cnvcOperName;
                busiLog.cnvcComments = "添加部门:" + this.txtDeptName.Text;
                busiLog.cnvcDeptID   = curDept.cnvcDeptID;
                busiLog.cnvcDeptName = curDept.cnvcDeptName;
                busiLog.cnvcOperType = "BS001";
                busiLog.cnvcSource   = "网站";
                DeptFacade.AddDept(dept, busiLog);
            }
            catch (Exception ex)
            {
                alertControl.Enable = true;
                alertControl.Msg    = ex.Message;
                return(false);
            }
            //成功添加部门
            alertControl.Action = AlertControl.ACTION.Script;
            alertControl.Enable = true;
            alertControl.Msg    = "成功添加部门";
            alertControl.Script = string.Format("window.parent.OnAddNodeResult('{0}','{1}','{2}');",
                                                "dept_" + hidParentID.Value, "dept_" + strDeptID, txtDeptName.Text);
            return(true);
        }
Пример #2
0
        public void BindDept2(DropDownList ddl, string strDeptID)
        {
            DataTable dtDept = DeptFacade.GetAllDept();

            DataView dv = new DataView(dtDept);

            dv.RowFilter       = "cnvcDeptID like '" + strDeptID + "%' or cnvcParentDeptID='" + strDeptID + "'";
            ddl.DataSource     = dv;
            ddl.DataTextField  = "cnvcDeptName";
            ddl.DataValueField = "cnvcDeptID";
            ddl.DataBind();
        }
Пример #3
0
        public void BindDept(DropDownList ddl, string strText, string strValue)
        {
            DataTable dtDept = DeptFacade.GetAllDept();

            ddl.DataSource     = dtDept;
            ddl.DataTextField  = "cnvcDeptName";
            ddl.DataValueField = "cnvcDeptID";
            ddl.DataBind();
            ListItem li = new ListItem(strText, strValue);

            ddl.Items.Insert(0, li);
        }
Пример #4
0
        bool UpdateDept()
        {
            if (txtDeptName.Text.Length == 0)
            {
                alertControl.Enable = true;
                alertControl.Msg    = "请输入部门名称";
                return(false);
            }
            try
            {
                DataTable dtCount = ReportQueryFacade.CommonQuery("select * from tbDept where cnvcDeptName = '" + this.txtDeptName.Text + "'");
                if (dtCount.Rows.Count > 1)
                {
                    throw new Exception("同名部门已存在,请添加新部门!");
                }
                Dept dept = new Dept();
                dept.cnvcDeptID       = this.txtDeptID.Text;
                dept.cnvcDeptName     = this.txtDeptName.Text;
                dept.cnvcParentDeptID = this.hidParentID.Value;
                dept.cnbValidate      = this.chkValidate.Checked;
                Dept    curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
                Oper    curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
                BusiLog busiLog = new BusiLog();
                busiLog.cndOperDate  = DateTime.Now;
                busiLog.cnnSerial    = Guid.NewGuid();
                busiLog.cnvcOperName = curOper.cnvcOperName;
                busiLog.cnvcComments = "修改部门名称为:" + this.txtDeptName.Text;
                busiLog.cnvcDeptID   = curDept.cnvcDeptID;
                busiLog.cnvcDeptName = curDept.cnvcDeptName;
                busiLog.cnvcOperType = "BS002";
                busiLog.cnvcSource   = "网站";

                DeptFacade.UpdateDept(dept, busiLog);
            }
            catch (Exception ex)
            {
                alertControl.Enable = true;
                alertControl.Msg    = ex.Message;
                return(false);
            }

            //成功更新部门
            alertControl.Action = AlertControl.ACTION.Script;
            alertControl.Enable = true;
            alertControl.Msg    = "成功更新部门信息";
            alertControl.Script = string.Format("window.parent.OnChangeNodeResult('{0}','{1}');",
                                                "dept_" + txtDeptID.Text, txtDeptName.Text);
            return(true);
        }
Пример #5
0
        void LoadDept()
        {
            Dept getDept = new Dept();

            getDept.cnvcDeptID = this.txtDeptID.Text;
            Dept dept = DeptFacade.GetDept(getDept);

            if (dept != null)
            {
                hidParentID.Value   = dept.cnvcParentDeptID;
                txtDeptName.Text    = dept.cnvcDeptName;
                chkValidate.Checked = dept.cnbValidate;
            }
            if (this.txtDeptID.Text == "0")
            {
                hidParentID.Value = "0";
                txtDeptName.Text  = CommonStatic.EnterpriseFullName();
            }
        }
Пример #6
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            try
            {
                decimal.Parse(txtOilPrice.Text);
            }
            catch (System.Exception)
            {
                this.Popup("请输入正确油价!");
            }
            if (txtOilPrice.Text == "")
            {
                this.Popup("请填写参数");
                return;
            }
            OilPrice price = new OilPrice();

            price.cnnSerialNo   = Guid.NewGuid();
            price.cndPriceDate  = DateTime.Now;
            price.cnnOilPrice   = decimal.Parse(txtOilPrice.Text);
            price.cnvcDeptName  = ddlDept.SelectedItem.Text;
            price.cnvcGoodsName = ddlGoodsName.SelectedItem.Text;
            price.cnvcGoodsType = ddlGoodsType.SelectedItem.Text;
            price.cnvcUnit      = ddlUnit.SelectedItem.Text;
            price.cndPriceDate  = DateTime.Parse(txtPriceDate.Text + " " + DateTime.Now.ToLongTimeString());

            Dept    curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
            Oper    curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
            BusiLog busiLog = new BusiLog();

            busiLog.cndOperDate  = DateTime.Now;
            busiLog.cnnSerial    = Guid.NewGuid();
            busiLog.cnvcOperName = curOper.cnvcOperName;
            busiLog.cnvcComments = "添加油价:" + price.cnvcDeptName + "|" + price.cnnOilPrice.ToString();
            busiLog.cnvcDeptID   = curDept.cnvcDeptID;
            busiLog.cnvcDeptName = curDept.cnvcDeptName;
            busiLog.cnvcOperType = "BS004";
            busiLog.cnvcSource   = "网站";

            DeptFacade.AddOilPrice(price, busiLog);
            Popup("油价添加成功");
            ddlDept_SelectedIndexChanged(null, null);
        }
Пример #7
0
        /// <summary>
        /// 加载部门字典
        /// </summary>
        public static void LoadDeptDictionary()
        {
            Hashtable lstDept = new Hashtable();
            DataTable tblDept = DeptFacade.GetAllDept();

            foreach (DataRow row in tblDept.Rows)
            {
                Dept objDept = new Dept(row);
                if (null == lstDept[objDept.cnvcDeptID])
                {
                    lstDept.Add(objDept.cnvcDeptID, objDept);
                }
            }
            Dept topDept = new Dept();

            topDept.cnvcDeptName = EnterpriseShortName();
            topDept.cnvcDeptID   = "00";
            lstDept.Add(topDept.cnvcDeptID, topDept);

            HttpContext.Current.Application[ConstValue.DEPT_DICTI_NAME] = lstDept;
        }
Пример #8
0
        public void BindDept(DropDownList ddl)
        {
            if (Session[ConstValue.LOGIN_USER_SESSION] == null || Session[ConstValue.LOGIN_USER_PURVIEW_SESSION] == null ||
                Session[ConstValue.LOGIN_DEPT_SESSION] == null)
            {
                this.Response.Redirect(@"..\Sysmanage\Default.aspx");
            }
            Dept dept = (Dept)Session[ConstValue.LOGIN_DEPT_SESSION];

            if (dept.cnvcDeptID != "00")
            {
                BindDept2(ddl, dept.cnvcDeptID);
            }
            else
            {
                DataTable dtDept = DeptFacade.GetAllDept();
                ddl.DataSource     = dtDept;
                ddl.DataTextField  = "cnvcDeptName";
                ddl.DataValueField = "cnvcDeptID";
                ddl.DataBind();
            }
        }
Пример #9
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            #region 设置所有菜单为隐藏

            tblUserInfo.Visible        = false;
            tblOilReports.Visible      = false;
            tblOilTotalReports.Visible = false;
            tblOilListReports.Visible  = false;
            tblMemberReports.Visible   = false;
            tblSysManage.Visible       = false;

            #endregion

            #region 显示当前登录用户信息

            //Session.RemoveAll();
            if (Session[ConstValue.LOGIN_USER_SESSION] != null)
            {
                Oper operCurrent = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
                //this.lblUserId.Text     = operCurrent.cnvcOperName;
                this.lblUserName.Text = operCurrent.cnvcOperName;

                Hashtable lstDept = new Hashtable();
                DataTable tblDept = DeptFacade.GetAllDept();

                foreach (DataRow row in tblDept.Rows)
                {
                    Dept objDept = new Dept(row);
                    if (null == lstDept[objDept.cnvcDeptID])
                    {
                        lstDept.Add(objDept.cnvcDeptID, objDept);
                    }
                }
                Dept topDept = new Dept();
                topDept.cnvcDeptName = CommonStatic.EnterpriseShortName();
                topDept.cnvcDeptID   = "00";
                lstDept.Add(topDept.cnvcDeptID, topDept);


                //Hashtable lstDept = Application[ConstValue.DEPT_DICTI_NAME] as Hashtable;
                Dept deptCurrent = lstDept[operCurrent.cnvcDeptID] as Dept;

                this.lblDeptName.Text = deptCurrent.cnvcDeptName;
                Session[ConstValue.LOGIN_DEPT_SESSION] = deptCurrent;
            }
            else
            {
                this.lblDeptName.Text = "";
                this.lblUserName.Text = "";
                //this.lblAddDate.Text = "";
                //this.lblLoginTime.Text = "";
                //this.lblLoginCount.Text = "";

                return;
            }

            #endregion



            #region 控制当前显示菜单

            string strShowMenuID = String.Empty;
            if (null != Request[ConstValue.SHOW_MENU_ARGS])
            {
                strShowMenuID = Request[ConstValue.SHOW_MENU_ARGS].ToString();
            }
            switch (strShowMenuID)
            {
            case "tblOilReports":
            case "tblOilTotalReports":
            case "tblOilListReports":
            case "tblMemberReports":
            case "tblSysManage":
                System.Web.UI.HtmlControls.HtmlTable tblCurrent = this.FindControl(strShowMenuID) as HtmlTable;
                tblCurrent.Visible = true;
                SetMenuShowByUserPurview(tblCurrent, tblCurrent, Session[ConstValue.LOGIN_USER_PURVIEW_SESSION] as ArrayList);
                break;
            }
            tblUserInfo.Visible = true;

            #endregion
        }
Пример #10
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            string[] strDests = hidDestID.Value.Split('_');
            string[] strSrcs  = hidSrcID.Value.Split('_');
            if (strSrcs.Length < 2 || strDests.Length < 2)
            {
                return;
            }
            switch (strSrcs[0])
            {
            case "oper":
            {
                bool bRet = false;
                try
                {
                    Oper oper = new Oper();
                    oper.cnnOperID  = int.Parse(strSrcs[1]);
                    oper.cnvcDeptID = strDests[1];

                    Dept    curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
                    Oper    curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
                    BusiLog busiLog = new BusiLog();
                    busiLog.cndOperDate  = DateTime.Now;
                    busiLog.cnnSerial    = Guid.NewGuid();
                    busiLog.cnvcOperName = curOper.cnvcOperName;
                    busiLog.cnvcComments = "移动操作员:" + oper.cnnOperID;
                    busiLog.cnvcDeptID   = curDept.cnvcDeptID;
                    busiLog.cnvcDeptName = curDept.cnvcDeptName;
                    busiLog.cnvcOperType = "BS008";
                    busiLog.cnvcSource   = "网站";

                    OperFacade.UpdatePwd(oper, busiLog);
                    bRet = true;
                }
                catch (Exception ex)
                {
                    alertControl.Enable = true;
                    alertControl.Msg    = ex.Message;
                }
                if (bRet)
                {
                    string strScript = string.Format("window.dialogArguments.src='{0}';window.dialogArguments.dest='{1}';",
                                                     hidSrcID.Value, hidDestID.Value);
                    Close(strScript, "成功移动用户");
                }
                break;
            }

            case "dept":
            {
                bool bRet = false;
                try
                {
                    Dept dept = new Dept();
                    dept.cnvcDeptID       = strSrcs[1];
                    dept.cnvcParentDeptID = strDests[1];

                    Dept    curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
                    Oper    curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
                    BusiLog busiLog = new BusiLog();
                    busiLog.cndOperDate  = DateTime.Now;
                    busiLog.cnnSerial    = Guid.NewGuid();
                    busiLog.cnvcOperName = curOper.cnvcOperName;
                    busiLog.cnvcComments = "移动部门:" + dept.cnvcDeptID;
                    busiLog.cnvcDeptID   = curDept.cnvcDeptID;
                    busiLog.cnvcDeptName = curDept.cnvcDeptName;
                    busiLog.cnvcOperType = "BS003";
                    busiLog.cnvcSource   = "网站";

                    DeptFacade.UpdateDept(dept, busiLog);
                    bRet = true;
                }
                catch (Exception ex)
                {
                    alertControl.Enable = true;
                    alertControl.Msg    = ex.Message;
                }
                if (bRet)
                {
                    string strScript = string.Format("window.dialogArguments.src='{0}';window.dialogArguments.dest='{1}';",
                                                     hidSrcID.Value, hidDestID.Value);
                    Close(strScript, "成功移动部门");
                }
                break;
            }
            }
        }