示例#1
0
        //编辑分类
        protected void Update_Click(object sender, EventArgs e)
        {
            CompanyClassInfo companyClassInfo = NonceCompanyClass;

            if (companyClassInfo.CompanyClassId != Guid.Empty)
            {
                try
                {
                    if (TV_CompanyClass.SelectedNode != null)
                    {
                        _companyClass.Update(companyClassInfo);
                        RadTreeNode currentNode = TV_CompanyClass.SelectedNode;
                        currentNode.Text = companyClassInfo.CompanyClassName + "(" + companyClassInfo.CompanyClassCode +
                                           ")";
                        currentNode.ToolTip = companyClassInfo.CompanyClassName + "(" +
                                              companyClassInfo.CompanyClassCode + ")";
                    }
                }
                catch
                {
                    RAM.Alert("往来单位分类更改失败!");
                }
            }
            else
            {
                RAM.Alert("根节点不允许更改!");
            }
        }
示例#2
0
        //选择添加新的往来单位分类
        protected void InsterItem(object sender, EventArgs e)
        {
            Guid parentCompanyClassId;

            if (TV_CompanyClass.SelectedNode == null)
            {
                parentCompanyClassId = Guid.Empty;
            }
            else
            {
                RadTreeNode currentNode = TV_CompanyClass.SelectedNode;
                parentCompanyClassId = new Guid(currentNode.Value);
            }
            var companyClassInfo = new CompanyClassInfo(Guid.NewGuid(), parentCompanyClassId, null, null);

            NonceCompanyClass            = companyClassInfo;
            ControlPanel.Visible         = false;
            IB_Add.Visible               = true;
            LBAddSpace.Visible           = true;
            IB_Update.Visible            = false;
            LBUpdateSpace.Visible        = false;
            IB_Cancel.Visible            = true;
            TB_CompanyClassCode.ReadOnly = false;
            TB_CompanyClassName.ReadOnly = false;
        }
示例#3
0
        //添加往来单位分类
        protected void Add_Click(object sender, EventArgs e)
        {
            if (NonceCompanyClass == null)
            {
                return;
            }
            CompanyClassInfo companyClassInfo = NonceCompanyClass;

            try
            {
                _companyClass.Insert(companyClassInfo);
                if (TV_CompanyClass.SelectedNode == null)
                {
                    RadTreeNode addNode =
                        CreateNode(companyClassInfo.CompanyClassName + "(" + companyClassInfo.CompanyClassCode + ")",
                                   false, companyClassInfo.CompanyClassId.ToString());
                    TV_CompanyClass.Nodes.Add(addNode);
                }
                else
                {
                    RadTreeNode currentNode = TV_CompanyClass.SelectedNode;
                    RadTreeNode addNode     =
                        CreateNode(companyClassInfo.CompanyClassName + "(" + companyClassInfo.CompanyClassCode + ")",
                                   false, companyClassInfo.CompanyClassId.ToString());
                    currentNode.Nodes.Add(addNode);
                    currentNode.Expanded = true;
                }
                InsterItem(sender, e);
            }
            catch
            {
                RAM.Alert("往来单位分类添加失败!");
            }
        }
示例#4
0
 //编辑选择的往来的单位分类
 protected void EditItem(object sender, EventArgs e)
 {
     if (TV_CompanyClass.SelectedNode != null)
     {
         RadTreeNode currentNode    = TV_CompanyClass.SelectedNode;
         var         companyClassId = new Guid(currentNode.Value);
         if (companyClassId != Guid.Empty)
         {
             NonceCompanyClass            = _companyClass.GetCompanyClass(companyClassId);
             ControlPanel.Visible         = false;
             IB_Add.Visible               = false;
             LBAddSpace.Visible           = false;
             IB_Update.Visible            = true;
             LBUpdateSpace.Visible        = true;
             IB_Cancel.Visible            = true;
             TB_CompanyClassCode.ReadOnly = false;
             TB_CompanyClassName.ReadOnly = false;
         }
         else
         {
             RAM.Alert("根节点不允许编辑。");
         }
     }
     else
     {
         RAM.Alert("您没有选择要编辑的往来单位分类!\n\n请从左边的往来单位分类树中选择要编辑的往来单位分类。");
     }
 }
示例#5
0
        //选择往来单位分类树节点
        protected void TvCompanyClassNodeClick(object sender, RadTreeNodeEventArgs e)
        {
            var companyClassId = new Guid(e.Node.Value);

            if (!IsInster)
            {
                NonceCompanyClass = companyClassId == Guid.Empty ? new CompanyClassInfo() : _companyClass.GetCompanyClass(companyClassId);
            }
            else
            {
                NonceCompanyClass = new CompanyClassInfo(Guid.NewGuid(), companyClassId, null, null);
            }
        }
示例#6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         IB_Add.Visible        = false;
         LBAddSpace.Visible    = false;
         IB_Update.Visible     = false;
         LBUpdateSpace.Visible = false;
         IB_Cancel.Visible     = false;
         NonceCompanyClass     = new CompanyClassInfo();
         GetTreeCompanyClass();
     }
 }
示例#7
0
        /// <summary>
        /// 获取往来单位列表
        /// </summary>
        /// <returns></returns>
        public IList <CompanyClassInfo> GetCompanyClassList()
        {
            IList <CompanyClassInfo> companyClassList = new List <CompanyClassInfo>();

            using (var rdr = SqlHelper.ExecuteReader(GlobalConfig.ERP_DB_NAME, true, SQL_SELECT_COMPANYCLASS_LIST, null))
            {
                while (rdr.Read())
                {
                    var companyClass = new CompanyClassInfo(rdr.GetGuid(0), rdr.GetGuid(1), rdr.GetString(2), rdr.GetString(3));
                    companyClassList.Add(companyClass);
                }
            }
            return(companyClassList);
        }
示例#8
0
 /// <summary>
 /// 更新往来单位信息
 /// </summary>
 /// <param name="companyClass">往来单位分类类实例</param>
 public void Update(CompanyClassInfo companyClass)
 {
     SqlParameter[] parms = GetCompanyClassParameters();
     parms[0].Value = companyClass.CompanyClassId;
     parms[1].Value = companyClass.ParentCompanyClassId;
     parms[2].Value = companyClass.CompanyClassCode;
     parms[3].Value = companyClass.CompanyClassName;
     try
     {
         SqlHelper.ExecuteNonQuery(GlobalConfig.ERP_DB_NAME, false, SQL_UPDATE_COMPANYCLASS, parms);
     }
     catch (Exception ex)
     {
         throw new ApplicationException(ex.Message);
     }
 }
示例#9
0
 //取消编辑或添加
 protected void Cancel_Click(object sender, EventArgs e)
 {
     ControlPanel.Visible         = true;
     IB_Add.Visible               = false;
     LBAddSpace.Visible           = false;
     IB_Update.Visible            = false;
     LBUpdateSpace.Visible        = false;
     IB_Cancel.Visible            = false;
     TB_CompanyClassCode.ReadOnly = true;
     TB_CompanyClassName.ReadOnly = true;
     if (TV_CompanyClass.SelectedNode != null)
     {
         var companyClassId = new Guid(TV_CompanyClass.SelectedNode.Value);
         NonceCompanyClass = _companyClass.GetCompanyClass(companyClassId);
     }
 }
示例#10
0
        //删除选择的往来单位分类
        protected void Delete_Click(object sender, EventArgs e)
        {
            if (TV_CompanyClass.SelectedNode != null)
            {
                RadTreeNode currentNode       = TV_CompanyClass.SelectedNode;
                RadTreeNode parentCurrentNode = currentNode.ParentNode;
                var         companyClassId    = new Guid(currentNode.Value);
                if (companyClassId != Guid.Empty)
                {
                    try
                    {
                        var companyClass = new BLL.Implement.Inventory.CompanyClass(_companyClass);
                        companyClass.Delete(companyClassId);

                        UnselectAllNodes(TV_CompanyClass);

                        if (currentNode.Parent != null)
                        {
                            parentCurrentNode.Selected = true;
                            parentCurrentNode.Nodes.Remove(currentNode);
                            NonceCompanyClass = _companyClass.GetCompanyClass(new Guid(parentCurrentNode.Value));
                        }
                        else
                        {
                            if (currentNode.Index > 0)
                            {
                                currentNode.TreeView.Nodes[currentNode.Index - 1].Selected = true;
                                NonceCompanyClass =
                                    _companyClass.GetCompanyClass(
                                        new Guid(currentNode.TreeView.Nodes[currentNode.Index - 1].Value));
                            }
                            TV_CompanyClass.Nodes.Remove(currentNode);
                        }
                    }
                    catch (Exception exp)
                    {
                        RAM.Alert("往来单位分类删除失败!\n\n错误提示:" + exp.Message);
                    }
                }
                else
                {
                    RAM.Alert("根节点不允许删除!");
                }
            }
        }
示例#11
0
        /// <summary>
        /// 获取指定分类的子分类列表
        /// </summary>
        /// <param name="parentCompanyClassId">父分类编号</param>
        /// <returns></returns>
        public IList <CompanyClassInfo> GetChildCompanyClassList(Guid parentCompanyClassId)
        {
            IList <CompanyClassInfo> companyClassList = new List <CompanyClassInfo>();
            var parm = new SqlParameter(PARM_PARENTCOMPANYCLASSID, SqlDbType.UniqueIdentifier)
            {
                Value = parentCompanyClassId
            };

            using (var rdr = SqlHelper.ExecuteReader(GlobalConfig.ERP_DB_NAME, true, SQL_SELECT_CHILDCOMPANYCLASS_LIST, parm))
            {
                while (rdr.Read())
                {
                    var companyClass = new CompanyClassInfo(rdr.GetGuid(0), rdr.GetGuid(1), rdr.GetString(2), rdr.GetString(3));
                    companyClassList.Add(companyClass);
                }
            }
            return(companyClassList);
        }
示例#12
0
        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RG_Power_InsertCommand(object sender, GridCommandEventArgs e)
        {
            var  editedItem    = e.Item as GridEditableItem;
            var  info          = new CompanyAuditingPowerInfo();
            Guid parentPowerID = Guid.NewGuid();

            info.PowerID = parentPowerID;
            if (editedItem != null)
            {
                info.FilialeId  = new Guid(((DropDownList)editedItem.FindControl("DDL_Filiale")).SelectedValue);
                info.BranchID   = new Guid(((DropDownList)editedItem.FindControl("DDL_Branch")).SelectedValue);
                info.PositionID = new Guid(((DropDownList)editedItem.FindControl("DDL_Position")).SelectedValue);
                info.LowerMoney = decimal.Parse(((TextBox)editedItem.FindControl("TB_MinAmount")).Text);
                info.UpperMoney = decimal.Parse(((TextBox)editedItem.FindControl("TB_MaxAmount")).Text);
            }
            info.BindingType   = (int)CompanyFundReceiptPowerBindType.DirectBind;
            info.CompanyID     = CompanyID;
            info.ParentPowerID = Guid.Empty;
            try
            {
                _powerWrite.InsertCompanyAuditingPower(info);
                CacheHelper.Remove(Key.AllCompanyAuditingPower);
                CompanyClassInfo companyClassInfo = _companyClass.GetCompanyClass(CompanyID);
                if (companyClassInfo.CompanyClassId != Guid.Empty)
                {
                    IList <CompanyClassInfo> classList = _companyClass.GetChildCompanyClassList(CompanyID).ToList();
                    if (classList.Count > 0)
                    {
                        foreach (CompanyClassInfo cInfo in classList)
                        {
                            info.PowerID       = Guid.NewGuid();
                            info.BindingType   = (int)CompanyFundReceiptPowerBindType.ExpandBind;
                            info.CompanyID     = cInfo.CompanyClassId;
                            info.ParentPowerID = parentPowerID;
                            _powerWrite.InsertCompanyAuditingPower(info);
                            CacheHelper.Remove(Key.AllCompanyAuditingPower);
                            IList <CompanyCussentInfo> cussentList = _companyCussent.GetCompanyCussentList(cInfo.CompanyClassId).ToList();
                            if (cussentList.Count > 0)
                            {
                                foreach (CompanyCussentInfo cussentInfo in cussentList)
                                {
                                    info.PowerID       = Guid.NewGuid();
                                    info.BindingType   = (int)CompanyFundReceiptPowerBindType.ExpandBind;
                                    info.CompanyID     = cussentInfo.CompanyId;
                                    info.ParentPowerID = parentPowerID;
                                    _powerWrite.InsertCompanyAuditingPower(info);
                                    CacheHelper.Remove(Key.AllCompanyAuditingPower);
                                }
                            }
                        }
                    }
                    else
                    {
                        IList <CompanyCussentInfo> cussentList = _companyCussent.GetCompanyCussentList(CompanyID).ToList();
                        if (cussentList.Count > 0)
                        {
                            foreach (CompanyCussentInfo cussentInfo in cussentList)
                            {
                                info.PowerID       = Guid.NewGuid();
                                info.BindingType   = (int)CompanyFundReceiptPowerBindType.ExpandBind;
                                info.CompanyID     = cussentInfo.CompanyId;
                                info.ParentPowerID = parentPowerID;
                                _powerWrite.InsertCompanyAuditingPower(info);
                                CacheHelper.Remove(Key.AllCompanyAuditingPower);
                            }
                        }
                    }
                }
                RG_Power.Rebind();
            }
            catch (Exception ex)
            {
                RAM.Alert("权限添加失败!" + ex);
            }
        }
示例#13
0
        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RG_Power_InsertCommand(object sender, GridCommandEventArgs e)
        {
            var  editedItem    = e.Item as GridEditableItem;
            var  info          = new CompanyInvoicePowerInfo();
            Guid parentPowerID = Guid.NewGuid();

            info.PowerID = parentPowerID;
            if (editedItem != null)
            {
                info.FilialeID    = new Guid(((DropDownList)editedItem.FindControl("DDL_Filiale")).SelectedValue);
                info.BranchID     = new Guid(((DropDownList)editedItem.FindControl("DDL_Branch")).SelectedValue);
                info.PositionID   = new Guid(((DropDownList)editedItem.FindControl("DDL_Position")).SelectedValue);
                info.AuditorID    = new Guid(((DropDownList)editedItem.FindControl("DDL_Personnel")).SelectedValue);
                info.InvoicesType = int.Parse(((DropDownList)editedItem.FindControl("DDL_InvoiceType")).SelectedValue);
            }
            info.BindingType   = (int)CompanyFundReceiptPowerBindType.DirectBind;
            info.CompanyID     = CompanyID;
            info.ParentPowerID = Guid.Empty;
            try
            {
                _companyInvoicePower.InsertCompanyInvoicePower(info);
                CompanyClassInfo companyClassInfo = _companyClass.GetCompanyClass(CompanyID);
                if (companyClassInfo.CompanyClassId != Guid.Empty)
                {
                    IList <CompanyClassInfo> classList = _companyClass.GetChildCompanyClassList(CompanyID).ToList();
                    if (classList.Count > 0)
                    {
                        foreach (CompanyClassInfo cInfo in classList)
                        {
                            info.PowerID       = Guid.NewGuid();
                            info.BindingType   = (int)CompanyFundReceiptPowerBindType.ExpandBind;
                            info.CompanyID     = cInfo.CompanyClassId;
                            info.ParentPowerID = parentPowerID;
                            _companyInvoicePower.InsertCompanyInvoicePower(info);

                            IList <CompanyCussentInfo> cussentList = _companyCussent.GetCompanyCussentList(cInfo.CompanyClassId).ToList();
                            if (cussentList.Count > 0)
                            {
                                foreach (CompanyCussentInfo cussentInfo in cussentList)
                                {
                                    info.PowerID       = Guid.NewGuid();
                                    info.BindingType   = (int)CompanyFundReceiptPowerBindType.ExpandBind;
                                    info.CompanyID     = cussentInfo.CompanyId;
                                    info.ParentPowerID = parentPowerID;
                                    _companyInvoicePower.InsertCompanyInvoicePower(info);
                                }
                            }
                        }
                    }
                    else
                    {
                        IList <CompanyCussentInfo> cussentList = _companyCussent.GetCompanyCussentList(CompanyID).ToList();
                        if (cussentList.Count > 0)
                        {
                            foreach (CompanyCussentInfo cussentInfo in cussentList)
                            {
                                info.PowerID       = Guid.NewGuid();
                                info.BindingType   = (int)CompanyFundReceiptPowerBindType.ExpandBind;
                                info.CompanyID     = cussentInfo.CompanyId;
                                info.ParentPowerID = parentPowerID;
                                _companyInvoicePower.InsertCompanyInvoicePower(info);
                            }
                        }
                    }
                }
                RG_Power.Rebind();
            }
            catch (Exception ex)
            {
                RAM.Alert("权限添加失败!" + ex);
            }
        }