예제 #1
0
        protected IList <SmartBox.Console.Common.Entities.SMC_Unit> GetUnitData()
        {
            List <SmartBox.Console.Common.Entities.SMC_Unit> units = new List <Common.Entities.SMC_Unit>();

            SmartBox.Console.Common.Entities.SMC_Unit unitDefault = new Common.Entities.SMC_Unit();
            unitDefault.Unit_Name = "请选择单位";
            unitDefault.Unit_ID   = "";
            units.Add(unitDefault);



            if (this.IsSystemManager)
            {
                IList <SmartBox.Console.Common.Entities.SMC_Unit> _units = Bo.BoFactory.GetSMC_UnitBo.GetAllUnits();
                units.AddRange(_units);
            }
            else
            {
                SmartBox.Console.Common.Entities.SMC_Unit unit = Bo.BoFactory.GetSMC_UnitBo.Get(this.CurrentUser.UnitCode);
                if (unit != null)
                {
                    units.Add(unit);
                }
            }
            return(units);
        }
예제 #2
0
        public JsonResult AddUnit(string unitCode, string unit)
        {
            IOrgService os = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();
            Hashtable   r  = new Hashtable();

            try
            {
                Org orgExists = os.GetOrgBaseInfo(ObjectType.Org, unitCode);
            }
            catch (ClientException ex)
            {
                if (ex.ErrCode == "9001")
                {
                    //unitCodeExists = false;
                    //msg = ex.Message;
                }
            }
            //Org org = new Org();
            //org.OrgCode = unitCode;
            //org.OrgName = unit;
            //org.ParentOrgCode = os.GetTopOrg().OrgCode;
            try
            {
                //os.AddOrg(org);
            }
            catch (ClientException e)
            {
                //1002,1003
                r["r"] = false;
                r["d"] = e.Message;
                return(Json(r));
            }

            SmartBox.Console.Common.Entities.SMC_Unit Unit = new Common.Entities.SMC_Unit();
            Unit.Unit_ID   = unitCode;
            Unit.Unit_Name = unit;
            Bo.BoFactory.GetSMC_UnitBo.InsertOrUpdate(Unit);


            r["r"] = true;
            r["d"] = "新增单位成功!";
            return(Json(r));
        }
        public JsonResult AddUnit(string unitCode, string unit)
        {
            IOrgService os = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();
            Hashtable r = new Hashtable();
            try
            {
                Org orgExists = os.GetOrgBaseInfo(ObjectType.Org, unitCode);
            }
            catch (ClientException ex)
            {
                if (ex.ErrCode == "9001")
                {
                    //unitCodeExists = false;
                    //msg = ex.Message;
                }
            }
            //Org org = new Org();
            //org.OrgCode = unitCode;
            //org.OrgName = unit;
            //org.ParentOrgCode = os.GetTopOrg().OrgCode;
            try
            {
                //os.AddOrg(org);
            }
            catch (ClientException e)
            {
                //1002,1003
                r["r"] = false;
                r["d"] = e.Message;
                return Json(r);
            }

            SmartBox.Console.Common.Entities.SMC_Unit Unit = new Common.Entities.SMC_Unit();
            Unit.Unit_ID = unitCode;
            Unit.Unit_Name = unit;
            Bo.BoFactory.GetSMC_UnitBo.InsertOrUpdate(Unit);

            r["r"] = true;
            r["d"] = "新增单位成功!";
            return Json(r);
        }
        protected IList<SmartBox.Console.Common.Entities.SMC_Unit> GetUnitData()
        {
            List<SmartBox.Console.Common.Entities.SMC_Unit> units = new List<Common.Entities.SMC_Unit>();
            SmartBox.Console.Common.Entities.SMC_Unit unitDefault = new Common.Entities.SMC_Unit();
            unitDefault.Unit_Name = "请选择单位";
            unitDefault.Unit_ID = "";
            units.Add(unitDefault);

            if (this.IsSystemManager)
            {
                IList<SmartBox.Console.Common.Entities.SMC_Unit> _units = Bo.BoFactory.GetSMC_UnitBo.GetAllUnits();
                units.AddRange(_units);
            }
            else
            {

                SmartBox.Console.Common.Entities.SMC_Unit unit = Bo.BoFactory.GetSMC_UnitBo.Get(this.CurrentUser.UnitCode);
                if (unit != null)
                    units.Add(unit);
            }
            return units;
        }