예제 #1
0
        /// <summary>
        /// A constructor as before, but with a UIDefName specified
        /// </summary>
        public PanelFactory(BusinessObject bo, string uiDefName, IControlFactory controlFactory)
        {
            _uiDefName = uiDefName;
            _controlFactory = controlFactory;
            BOMapper mapper = new BOMapper(bo);

            IUIDef uiDef = mapper.GetUIDef(uiDefName);
            if (uiDef == null)
            {
                string errMessage = "Cannot create a panel factory for '" + bo.ClassDef.ClassName
                                    + "' since the classdefs do not contain a uiDef '" + uiDefName + "'";
                throw new HabaneroDeveloperException
                    ("There is a serious application error please contact your system administrator"
                     + Environment.NewLine + errMessage, errMessage);
            }
            _uiForm = uiDef.GetUIFormProperties();
            if (_uiForm == null)
            {
                string errMsg = "Cannot create a panel factory for '" + bo.ClassDef.ClassName
                                + "' since the classdefs do not contain a form def for uidef '" + uiDefName + "'";
                throw new HabaneroDeveloperException
                    ("There is a serious application error please contact your system administrator"
                     + Environment.NewLine + errMsg, errMsg);
            }
            InitialiseFactory(bo);
        }
예제 #2
0
파일: FormEx.cs 프로젝트: ToughBill/NanCrm
 public FormEx(BOIDEnum boId)
 {
     InitializeComponent();
     m_boId = boId;
     m_bo = BOFactory.GetBO(m_boId);
     m_formMode = FormMode.Ok;
 }
예제 #3
0
파일: FormEx.cs 프로젝트: ToughBill/NanCrm
 public FormEx()
 {
     InitializeComponent();
     m_boId = BOIDEnum.Invalid;
     m_bo = null;
     m_formMode = FormMode.Ok;
 }
예제 #4
0
 /// <summary>
 /// A constructor to initialise a new instance, with a UIForm object 
 /// specified
 /// </summary>
 /// <param name="bo">The business object to be represented</param>
 /// <param name="uiForm"></param>
 /// <param name="controlFactory">the control factory used to create controls</param>
 public PanelFactory(BusinessObject bo, UIForm uiForm, IControlFactory controlFactory)
 {
     if (uiForm == null) throw new ArgumentNullException("uiForm");
     _uiForm = uiForm;
     _controlFactory = controlFactory;
     InitialiseFactory(bo);
 }
예제 #5
0
 public FormBase()
 {
     InitializeComponent();
     m_boId = BOIDEnum.Invalid;
     m_bo = null;
     m_formMode = FormMode.Ok;
     m_needCallRetProc = true;
 }
예제 #6
0
 public FormBase(BOIDEnum boId)
 {
     InitializeComponent();
     m_boId = boId;
     m_bo = BOFactory.GetBO(m_boId);
     m_formMode = FormMode.Ok;
     m_needCallRetProc = true;
 }
 public void DoSomething()
 {
     // Add some contextual information to the store.
     ServiceContextStore.Current.Add("MyContextualInformation", "value");
     // Now invoke the business facade which in turn consumes that information.
     IBusinessObject businessObject = new BusinessObject();
     businessObject.DoBusiness();
 }
예제 #8
0
        public void MakeDataBind(Control _ctrl)
        {
            if (ClassName == string.Empty && _bindObject == null)
                return;

            _bindObject = MetaObjectActivator.CreateInstance<BusinessObject>(MetaDataWrapper.ResolveMetaClassByNameOrCardName(ClassName), ObjectId);

            MakeDataBindColl(_ctrl.Controls, _bindObject);
        }
예제 #9
0
        public void ShouldExtractAdvancedPropertyState()
        {
            BusinessObject component = new BusinessObject();

              PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name"));
              Assert.IsFalse(property.IsAdvanced);

              property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("AdvancedProperty"));
              Assert.IsTrue(property.IsAdvanced);
        }
예제 #10
0
 /// <summary>
 /// Constructor to initialise a new instance of pessimistic locking with the property details
 /// form implementing the pessimistic locking strategy.
 /// </summary>
 /// <param name="busObj">The business object on which to perform concurrency control</param>
 /// <param name="lockDurationInMinutes">The period of time that the lock will be maintained</param>
 /// <param name="boPropDateTimeLocked">The date that the object was locked</param>
 /// <param name="boPropUserLocked">The user that locked the object</param>
 /// <param name="boPropMachineLocked">The machine name on which the object was last updated</param>
 /// <param name="boPropOperatingSystemUser">The Windows logged on user who locked the object</param>
 /// <param name="boPropLocked">The property that determines whether the object is locked or not</param>
 public PessimisticLockingDB(BusinessObject busObj, int lockDurationInMinutes, IBOProp boPropDateTimeLocked, IBOProp boPropUserLocked, IBOProp boPropMachineLocked, IBOProp boPropOperatingSystemUser, IBOProp boPropLocked)
 {
     _busObj = busObj;
     _lockDurationInMinutes = lockDurationInMinutes;
     _boPropDateLocked = OrphanFromBOStatus(boPropDateTimeLocked);
     _boPropUserLocked = OrphanFromBOStatus(boPropUserLocked);
     _boPropMachineLocked = OrphanFromBOStatus(boPropMachineLocked);
     _boPropOperatingSystemUser = OrphanFromBOStatus(boPropOperatingSystemUser);
     _boPropLocked = OrphanFromBOStatus(boPropLocked);
 }
 /// <summary>
 /// Constructor to initialise the exception with details regarding the
 /// object whose record was deleted
 /// </summary>
 /// <param name="bo">The business object in question</param>
 /// <param name="message">Additional message</param>
 public BusObjEditableException(BusinessObject bo, string message)
     :
         base(
             string.Format(
                 "You cannot Edit the '{0}', as the IsEditable is set to false for the object. " +
                 "ObjectID: {1}, also identified as {2} \n " + 
                 "Message: {3}",
                 bo.ClassDef.ClassName, bo.ID, bo, message))
 {
 }
예제 #12
0
 public override bool Validate(BusinessObject businessObject)
 {
     try
     {
         return GetPropertyValue(businessObject).ToString().Length > 0;
     }
     catch
     {
         return false;
     }
 }
예제 #13
0
        public void ShouldClearValue()
        {
            BusinessObject component = new BusinessObject() { Name = "TestName" };
              PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name"));

              Assert.AreEqual<string>("TestName", property.GetValue().ToString());

              property.ClearValue();

              Assert.AreEqual<string>("DefaultName", property.GetValue().ToString());
        }
예제 #14
0
 public override bool Validate(BusinessObject businessObject)
 {
     try
     {
         int id = int.Parse(GetPropertyValue(businessObject).ToString());
         return id >= 0;
     }
     catch
     {
         return false;
     }
 }
 public static void AssertBOStateIsValidAfterInsert_Updated(BusinessObject businessObject)
 {
    
     Assert.IsFalse(businessObject.Status.IsNew);
     Assert.IsFalse(businessObject.Status.IsDirty);
     Assert.IsFalse(businessObject.Status.IsDeleted);
     Assert.IsFalse(businessObject.Status.IsEditing);
     Assert.IsTrue(businessObject.Status.IsValid());
     string message;
     Assert.IsTrue(businessObject.Status.IsValid(out message));
     Assert.AreEqual("", message);
 }
        public void SetupTestForFilledCircleNoPK()
        {
            this.SetupDBConnection();
            ClearTables();
            SetupInheritanceSpecifics();
            _filledCircle = new FilledCircleNoPrimaryKey();
            SetStrID();
            _filledCircle.SetPropertyValue("Colour", 3);
            _filledCircle.SetPropertyValue("Radius", 10);
            _filledCircle.SetPropertyValue("ShapeName", "MyFilledCircle");

            SetupGeneratedStatements();
        }
 /// <summary>
 /// Constructor to initialise a new instance with details of the last
 /// update of the object in the database
 /// </summary>
 /// <param name="busObj">The business object on which to perform concurrency control</param>
 /// <param name="dateLastUpdated">The date that the object was
 /// last updated</param>
 /// <param name="userLastUpdated">The user that last updated the
 /// object</param>
 /// <param name="machineLastUpdated">The machine name on which the
 /// object was last updated</param>
 /// <param name="versionNumber">The version number</param>
 public OptimisticLockingVersionNumberDB(BusinessObject busObj,
                                         IBOProp dateLastUpdated,
                                         IBOProp userLastUpdated,
                                         IBOProp machineLastUpdated,
                                         IBOProp versionNumber)
 {
     _busObj = busObj;
     _dateLastUpdated = dateLastUpdated;
     _userLastUpdated = userLastUpdated;
     _machineLastUpdated = machineLastUpdated;
     _versionNumber = versionNumber;
     _operatingSystemUser = null;
 }
예제 #18
0
        public override bool Validate(BusinessObject businessObject)
        {
            try
            {
                string value = GetPropertyValue(businessObject).ToString();

                switch (DataType)
                {
                    case ValidationDataType.Integer:

                        int imin = int.Parse(Min.ToString());
                        int imax = int.Parse(Max.ToString());
                        int ival = int.Parse(value);

                        return (ival >= imin && ival <= imax);

                    case ValidationDataType.Double:
                        double dmin = double.Parse(Min.ToString());
                        double dmax = double.Parse(Max.ToString());
                        double dval = double.Parse(value);

                        return (dval >= dmin && dval <= dmax);

                    case ValidationDataType.Decimal:
                        decimal cmin = decimal.Parse(Min.ToString());
                        decimal cmax = decimal.Parse(Max.ToString());
                        decimal cval = decimal.Parse(value);

                        return (cval >= cmin && cval <= cmax);

                    case ValidationDataType.Date:
                        DateTime tmin = DateTime.Parse(Min.ToString());
                        DateTime tmax = DateTime.Parse(Max.ToString());
                        DateTime tval = DateTime.Parse(value);

                        return (tval >= tmin && tval <= tmax);

                    case ValidationDataType.String:

                        string smin = Min.ToString();
                        string smax = Max.ToString();

                        int result1 = string.Compare(smin, value);
                        int result2 = string.Compare(value, smax);

                        return result1 >= 0 && result2 <= 0;
                }
                return false;
            }
            catch { return false; }
        }
예제 #19
0
 public void SetupTestWithoutPrimaryKey()
 {
     ClassDef.ClassDefs.Clear();
     this.SetupDBConnection();
     DatabaseConnection.CurrentConnection.ExecuteRawSql("delete from filledcircle_table;");
     DatabaseConnection.CurrentConnection.ExecuteRawSql("delete from circle_table;");
     DatabaseConnection.CurrentConnection.ExecuteRawSql("delete from circle_concrete;");
     DatabaseConnection.CurrentConnection.ExecuteRawSql("delete from shape_table;");
     SetupInheritanceSpecifics();
     objCircle = new CircleNoPrimaryKey();
     SetStrID();
     objCircle.SetPropertyValue("ShapeName", "MyShape");
     objCircle.SetPropertyValue("Radius", 10);
     SetupGeneratedStatements();
 }
예제 #20
0
        public void ShouldAllowClearingValueAccordingToDescriptor()
        {
            BusinessObject component = new BusinessObject();

              PropertyDescriptor descriptor = BusinessObject.ExtractProperty("Name");
              PropertyItem property = new PropertyItem(new PropertyGrid(), component, descriptor);

              Assert.IsTrue(property.CanClearValue);
              Assert.AreEqual<bool>(descriptor.CanResetValue(component), property.CanClearValue);

              descriptor = BusinessObject.ExtractProperty("ReadOnlyProperty");
              property = new PropertyItem(new PropertyGrid(), component, descriptor);

              Assert.IsFalse(property.CanClearValue);
              Assert.AreEqual<bool>(descriptor.CanResetValue(component), property.CanClearValue);
        }
        public void SetupTestForFilledCircleInheritsCircleNoPK()
        {
            this.SetupDBConnection();
            ClearTables();
            SetupInheritanceSpecifics();
            _filledCircle = new FilledCircleInheritsCircleNoPK();
            SetStrID();
            _filledCircle.SetPropertyValue("Colour", 3);
            _filledCircle.SetPropertyValue("Radius", 10);
            _filledCircle.SetPropertyValue("ShapeName", "MyFilledCircle");

            _insertSql =
                new InsertStatementGenerator(_filledCircle, DatabaseConnection.CurrentConnection).Generate();
            _updateSql = new UpdateStatementGenerator(_filledCircle, DatabaseConnection.CurrentConnection).Generate();
            _deleteSql = new DeleteStatementGenerator(_filledCircle, DatabaseConnection.CurrentConnection).Generate();
        }
예제 #22
0
        public void SetupTest()
        {
            ClassDef.ClassDefs.Clear();

            this.SetupDBConnection();
            DatabaseConnection.CurrentConnection.ExecuteRawSql("delete from filledcircle_table;");
            DatabaseConnection.CurrentConnection.ExecuteRawSql("delete from circle_table;");
            DatabaseConnection.CurrentConnection.ExecuteRawSql("delete from circle_concrete;");
            DatabaseConnection.CurrentConnection.ExecuteRawSql("delete from shape_table;");
            SetupInheritanceSpecifics();
            objCircle = new Circle();
            SetStrID();
            objCircle.SetPropertyValue("ShapeName", "MyShape");
            objCircle.SetPropertyValue("Radius", 10);
            itsInsertSql =
                new InsertStatementGenerator(objCircle, DatabaseConnection.CurrentConnection).Generate();
            itsUpdateSql = new UpdateStatementGenerator(objCircle, DatabaseConnection.CurrentConnection).Generate();
            itsDeleteSql = new DeleteStatementGenerator(objCircle, DatabaseConnection.CurrentConnection).Generate();
        }
예제 #23
0
파일: ViewModel.cs 프로젝트: petriw/Balder
        public ViewModel()
        {
            /*
            Objects = new ObservableCollection<BusinessObject>
                      	{
                      		new BusinessObject {Color = Color.FromSystemColor(Colors.Red), Position = new Coordinate(-120, 0, 0)},
                      		new BusinessObject {Color = Color.FromSystemColor(Colors.Green), Position = new Coordinate(0, 0, 0)},
                      		new BusinessObject {Color = Color.FromSystemColor(Colors.Blue), Position = new Coordinate(120, 0, 0)}
                      	};*/

            Objects = new ObservableCollection<BusinessObject>();

            var zCount = 25;
            var xCount = 25;

            var zDistance = 12d;
            var xDistance = 12d;

            var currentZ = -((zCount / 2d) * zDistance);
            for (var z = 0; z < zCount; z++)
            {
                var currentX = -((xCount / 2d) * xDistance);
                for (var x = 0; x < xCount; x++)
                {
                    var obj = new BusinessObject
                                {
                                    Position = new Coordinate(currentX, 0, currentZ),
                                    Color = Color.Random()
                                };
                    Objects.Add(obj);
                    currentX += xDistance;
                }

                currentZ += zDistance;
            }
        }
예제 #24
0
        public static BusinessObject GetBO(BOIDEnum boid)
        {
            BusinessObject bo = null;

            switch (boid)
            {
            case BOIDEnum.BOSequence:
                bo = new BOSequence();
                break;

            case BOIDEnum.Country:
                bo = new BOCountry();
                break;

            case BOIDEnum.ProductGroup:
                bo = new BOProductGroup();
                break;

            case BOIDEnum.Market:
                bo = new BOMarket();
                break;

            case BOIDEnum.MarketDetail:
                bo = new BOMarketDetail();
                break;

            case BOIDEnum.SearchPlantf:
                bo = new BOBPSearchPlan();
                break;

            case BOIDEnum.Texture:
                bo = new BOTexture();
                break;

            case BOIDEnum.KeyWord:
                bo = new BOKeyWord();
                break;

            case BOIDEnum.KeyWordList:
                bo = new BOKWList();
                break;

            case BOIDEnum.Product:
                bo = new BOProduct();
                break;

            case BOIDEnum.PSearchPlan:
                bo = new BOProductSearchPlan();
                break;

            case BOIDEnum.PSearchResult:
                bo = new BOBPSearchResult();
                break;

            case BOIDEnum.BP:
                bo = new BOBP();
                break;

            default: break;
            }
            bo.Init();
            return(bo);
        }
예제 #25
0
        virtual protected void Page_Load(object sender, System.EventArgs e)
        {
            bool   retrieveValues = false;
            string pks            = Request["pkey"];

            if (pks != null && pks.Length > 0)
            {
                primaryKey = int.Parse(pks);
                //v4.0 model = new DynamicModel(tableName, primaryKey, patientID, new ValidateNullsDelegate(NullsValidatorWrapper.ValidateNullsHaveData));
                // model = new DynamicModel();

                bizo = BusinessObjectFactory.BuildBusinessObject(tableName);
                bizo.Get(primaryKey);

                retrieveValues = true;

                // peek at the lockedby
                if (bizo.HasField(BusinessObject.LockedBy))
                {
                    if (bizo[BusinessObject.LockedBy] != null && !string.IsNullOrEmpty(bizo[BusinessObject.LockedBy].ToString()))
                    {
                        recordIsLocked = true;
                    }
                }
            }
            else
            {
                //v4.0 model = new DynamicModel(tableName, patientID, new ValidateNullsDelegate(NullsValidatorWrapper.ValidateNullsHaveData));
                // model = new DynamicModel();

                bizo = BusinessObjectFactory.BuildBusinessObject(tableName);

                // is this necessary?
                if (bizo.HasField("PatientId"))
                {
                    bizo["PatientId"] = patientID;
                }
            }

            // set parent biz
            if (bizo != null)
            {
                // LOAD OPTIONAL PARENT TABLE

                // verify has parent which isn't Patient
                if (!string.IsNullOrEmpty(bizo.ParentTableName) && bizo.ParentTableName != "Patients")
                {
                    // validate no multiple foreign keys
                    if (bizo.ForeignKeyNames.Count() == 1 && !bizo.ForeignKeyNames.Contains(Patient.PatientId))
                    {
                        var pBiz = BusinessObjectFactory.BuildBusinessObject(bizo.ParentTableName);
                        // one last verification
                        if (!(pBiz is Patient))
                        {
                            parent = pBiz;
                            // load parent biz if applicable
                            if (bizo.PrimaryKeyHasValue)
                            {
                                int parPriKey = (int)bizo[bizo.ParentKeyName];
                                parent.Get(parPriKey);
                            }
                        }
                    }
                }
                // LOAD CHILD TABLES
                if (ChildTableNames.Length > 0)
                {
                    // rebuild child table lookup
                    _children = new Dictionary <string, IEnumerable <IBusinessObject> >();

                    int parentKey = (int)bizo[bizo.PrimaryKeyName];
                    // build lookup: child table -> child records
                    var childTableNames     = ChildTableNames.Where(t => BusinessObject.GetParentTablename(t) == bizo.TableName);
                    var childTableToRecords = childTableNames.ToDictionary(t => t, t => BusinessObject.GetByParent(t, parentKey));

                    // validation: validate children
                    foreach (var child in childTableToRecords)
                    {
                        string childTable = child.Key;
                        IEnumerable <IBusinessObject> childBizos = child.Value;

                        // if child is grid with no record, create blank data
                        bool isGrid = pdec.IsGridView(childTable);
                        if (isGrid && childBizos.Count() == 0)
                        {
                            // init blank rows
                            childBizos = new IBusinessObject[] { BusinessObjectFactory.BuildBusinessObject(childTable) };
                            // set parent key
                            foreach (var b in childBizos)
                            {
                                b[b.ParentKeyName] = parentKey;
                            }
                        }
                        // add entry
                        _children.Add(childTable, childBizos);
                    }
                }
            }

            if (Page.IsPostBack)
            {
                BuildControls(bizo, false);
            }
            else
            {
                BuildControls(bizo, retrieveValues);
            }
            // init field-tracking: note late bound binding
            foreach (var input in PageUtil.GetControls <ICaisisInputControl>(Page))
            {
                input.ValueChanged += MarkTableFieldsDirty;
            }
        }
예제 #26
0
        protected override void CreateKeyParameters(BusinessObject businessObject, System.Data.IDbCommand cmd)
        {
            Parametro param = (Parametro)businessObject;

            DALObject.CreateParameter(cmd, "@CNPJ", System.Data.DbType.String, param.empresa);
        }
        protected override void DataReaderToPersistentObject(System.Data.IDataReader dataReader, BusinessObject businessObject, string radical)
        {
            NotaFiscal nota = (NotaFiscal)businessObject;

            nota.BeginInit();
            try
            {
                nota.empresa           = Utils.FieldAsString(dataReader, "CNPJ");
                nota.chaveNota         = Utils.FieldAsString(dataReader, "ChaveNota");
                nota.numeroLote        = Utils.FieldAsInt32(dataReader, "NumeroLote");
                nota.codigoSituacao    = (TipoSituacaoNota)Utils.FieldAsInt32(dataReader, "CodigoSituacao");
                nota.descricaoSituacao = Utils.FieldAsString(dataReader, "DescricaoSituacao");
                nota.dataSituacao      = Utils.FieldAsDateTime(dataReader, "DataSituacao");
                nota.xmlNota           = Utils.FieldAsString(dataReader, "XMLNotaFiscal");
                nota.xmlProcesso       = Utils.FieldAsString(dataReader, "XMLProcesso");
                nota.cStat             = Utils.FieldAsString(dataReader, "cStat");
                nota.xMotivo           = Utils.FieldAsString(dataReader, "xMotivo");
                nota.nProt             = Utils.FieldAsString(dataReader, "nProt");

                nota.xmlPedidoCancelamento   = Utils.FieldAsString(dataReader, "xmlPedidoCancelamento");
                nota.xmlProcessoCancelamento = Utils.FieldAsString(dataReader, "xmlProcessoCancelamento");
                nota.nProtCancelamento       = Utils.FieldAsString(dataReader, "nProtCancelamento");
                nota.versao = (VersaoXML)Utils.FieldAsInt32(dataReader, "versao");

                nota.isRecorded = true;
                nota.isModified = false;
            }
            finally
            {
                nota.EndInit();
            }
        }
예제 #28
0
        private List <BusinessObject> GetTextWrapDataSource()
        {
            List <BusinessObject> BusinessObjectCollection = new List <BusinessObject>();

            BusinessObject Record1 = new BusinessObject()
            {
                TaskId    = 1,
                TaskName  = "Design",
                StartDate = "02/10/2017",
                EndDate   = "02/14/2017",
                Progress  = 86,
                Duration  = 3,
                Children  = new List <BusinessObject>(),
            };

            BusinessObject Child1 = new BusinessObject()
            {
                TaskId    = 2,
                TaskName  = "Software Specification",
                StartDate = "02/10/2017",
                EndDate   = "02/12/2017",
                Duration  = 3,
                Progress  = 60
            };

            BusinessObject Child2 = new BusinessObject()
            {
                TaskId    = 3,
                TaskName  = "Develop prototype",
                StartDate = "02/10/2017",
                EndDate   = "02/12/2017",
                Duration  = 3,
                Progress  = 100
            };

            BusinessObject Child3 = new BusinessObject()
            {
                TaskId    = 4,
                TaskName  = "Get approval from customer",
                StartDate = "02/13/2017",
                EndDate   = "02/14/2017",
                Duration  = 2,
                Progress  = 100
            };

            BusinessObject Child4 = new BusinessObject()
            {
                TaskId    = 5,
                TaskName  = "Design complete",
                StartDate = "02/14/2017",
                EndDate   = "02/14/2017",
                Duration  = 0,
                Progress  = 0
            };

            Record1.Children.Add(Child1);
            Record1.Children.Add(Child2);
            Record1.Children.Add(Child3);
            Record1.Children.Add(Child4);
            BusinessObject Record2 = new BusinessObject()
            {
                TaskId    = 6,
                TaskName  = "Implementation Phase",
                StartDate = "02/17/2017",
                EndDate   = "02/17/2017",
                Children  = new List <BusinessObject>(),
            };

            BusinessObject Record3 = new BusinessObject()
            {
                TaskId    = 7,
                TaskName  = "Phase 1",
                StartDate = "02/17/2017",
                EndDate   = "02/27/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Record6 = new BusinessObject()
            {
                TaskId    = 8,
                TaskName  = "Implementation Module 1",
                StartDate = "02/17/2017",
                EndDate   = "02/27/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Child5 = new BusinessObject()
            {
                TaskId    = 9,
                TaskName  = "Development Task 1",
                StartDate = "02/17/2017",
                EndDate   = "02/19/2017",
                Duration  = 3,
                Progress  = 50
            };
            BusinessObject Child6 = new BusinessObject()
            {
                TaskId    = 10,
                TaskName  = "Development Task 2",
                StartDate = "02/17/2017",
                EndDate   = "02/19/2017",
                Duration  = 3,
                Progress  = 50
            };
            BusinessObject Child7 = new BusinessObject()
            {
                TaskId    = 11,
                TaskName  = "Testing",
                StartDate = "02/20/2017",
                EndDate   = "02/21/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child8 = new BusinessObject()
            {
                TaskId    = 12,
                TaskName  = "Bug fix",
                StartDate = "02/24/2017",
                EndDate   = "02/25/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child9 = new BusinessObject()
            {
                TaskId    = 13,
                TaskName  = "Customer review meeting",
                StartDate = "02/26/2017",
                EndDate   = "02/27/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child10 = new BusinessObject()
            {
                TaskId    = 14,
                TaskName  = "Phase 1 complete",
                StartDate = "02/27/2017",
                EndDate   = "02/27/2017",
                Duration  = 2,
                Progress  = 0
            };

            Record6.Children.Add(Child5);
            Record6.Children.Add(Child6);
            Record6.Children.Add(Child7);
            Record6.Children.Add(Child8);
            Record6.Children.Add(Child9);
            Record6.Children.Add(Child10);
            Record3.Children.Add(Record6);
            Record2.Children.Add(Record3);
            BusinessObject Record4 = new BusinessObject()
            {
                TaskId    = 15,
                TaskName  = "Phase 2",
                StartDate = "02/17/2017",
                EndDate   = "02/28/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Record7 = new BusinessObject()
            {
                TaskId    = 16,
                TaskName  = "Implementation Module 2",
                StartDate = "02/17/2017",
                EndDate   = "02/28/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Child11 = new BusinessObject()
            {
                TaskId    = 17,
                TaskName  = "Development Task 1",
                StartDate = "02/17/2017",
                EndDate   = "02/20/2017",
                Duration  = 4,
                Progress  = 50
            };
            BusinessObject Child12 = new BusinessObject()
            {
                TaskId    = 18,
                TaskName  = "Development Task 2",
                StartDate = "02/17/2017",
                EndDate   = "02/20/2017",
                Duration  = 4,
                Progress  = 50
            };
            BusinessObject Child13 = new BusinessObject()
            {
                TaskId    = 19,
                TaskName  = "Testing",
                StartDate = "02/21/2017",
                EndDate   = "02/24/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child14 = new BusinessObject()
            {
                TaskId    = 20,
                TaskName  = "Bug fix",
                StartDate = "02/25/2017",
                EndDate   = "02/26/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child15 = new BusinessObject()
            {
                TaskId    = 21,
                TaskName  = "Customer review meeting",
                StartDate = "02/27/2017",
                EndDate   = "02/28/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child16 = new BusinessObject()
            {
                TaskId    = 22,
                TaskName  = "Phase 2 complete",
                StartDate = "02/28/2017",
                EndDate   = "02/28/2017",
                Duration  = 2,
            };

            Record7.Children.Add(Child11);
            Record7.Children.Add(Child12);
            Record7.Children.Add(Child13);
            Record7.Children.Add(Child14);
            Record7.Children.Add(Child15);
            Record7.Children.Add(Child16);
            Record4.Children.Add(Record7);
            Record2.Children.Add(Record4);
            BusinessObject Record5 = new BusinessObject()
            {
                TaskId    = 23,
                TaskName  = "Phase 3",
                StartDate = "02/17/2017",
                EndDate   = "02/27/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Record8 = new BusinessObject()
            {
                TaskId    = 24,
                TaskName  = "Implementation Module 3",
                StartDate = "02/17/2017",
                EndDate   = "02/27/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Child17 = new BusinessObject()
            {
                TaskId    = 25,
                TaskName  = "Development Task 1",
                StartDate = "02/17/2017",
                EndDate   = "02/19/2017",
                Duration  = 3,
                Progress  = 50
            };
            BusinessObject Child18 = new BusinessObject()
            {
                TaskId    = 26,
                TaskName  = "Development Task 2",
                StartDate = "02/17/2017",
                EndDate   = "02/19/2017",
                Duration  = 3,
                Progress  = 50
            };
            BusinessObject Child19 = new BusinessObject()
            {
                TaskId    = 27,
                TaskName  = "Testing",
                StartDate = "02/20/2017",
                EndDate   = "02/21/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child20 = new BusinessObject()
            {
                TaskId    = 28,
                TaskName  = "Bug fix",
                StartDate = "02/24/2017",
                EndDate   = "02/25/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child21 = new BusinessObject()
            {
                TaskId    = 29,
                TaskName  = "Customer review meeting",
                StartDate = "02/26/2017",
                EndDate   = "02/27/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child22 = new BusinessObject()
            {
                TaskId    = 30,
                TaskName  = "Phase 3 complete",
                StartDate = "02/27/2017",
                EndDate   = "02/27/2017",
                Duration  = 2,
            };

            Record8.Children.Add(Child17);
            Record8.Children.Add(Child18);
            Record8.Children.Add(Child17);
            Record8.Children.Add(Child20);
            Record8.Children.Add(Child21);
            Record8.Children.Add(Child22);
            Record5.Children.Add(Record8);
            Record2.Children.Add(Record5);
            BusinessObjectCollection.Add(Record1);
            BusinessObjectCollection.Add(Record2);

            return(BusinessObjectCollection);
        }
예제 #29
0
        public override void SetKey(BusinessObject businessObject)
        {
            Parametro param = (Parametro)businessObject;

            empresa = param.empresa;
        }
예제 #30
0
        protected override void Execute(CodeActivityContext context)
        {
            Log.Current.Debug(logFac, "Execution has been started!");

            var targetCRUDs = context.GetValue(this.targetCRUDs);
            var xmlResponse = new XmlDocument();

            xmlResponse.LoadXml(context.GetValue(this.xmlResponse));

            var crudItems = xmlResponse.SelectNodes("/response/*[name()='update' or name()='import']").OfType <XmlNode>();

            // nothing happened -> return
            Log.Current.DebugFormat(logFac, "{0} CRUD items are announced to be affected", targetCRUDs.Count);
            Log.Current.DebugFormat(logFac, "{0} CRUD items has been found in the processed response.", crudItems.Count());
            if (crudItems.Count() < 1)
            {
                return;
            }

            using (Session.EnsureScope(Guid.NewGuid().ToString()))
                using (var suSession = ApplicationServices.Get <ICrmBaseApplication>().CreateSpecialUserSession())
                {
                    var suServices = suSession.Services;
                    var eventHub   = suServices.Get <IEventHub>();

                    for (int i = 0; i < crudItems.Count(); i++)
                    {
                        Log.Current.DebugFormat(logFac, "trying to fire with CRUD element at {0}", i);

                        var crudNode = crudItems.ElementAt(i);
                        if (crudNode.FirstChild.Attributes["type"].Value == "error")
                        {
                            continue;
                        }

                        var currentCRUDOp = targetCRUDs.ElementAt(i);
                        if (
                            currentCRUDOp.Item1 != crudNode.Name || // should never be the case, but integrity must be guaranteed
                            currentCRUDOp.Item2 == null
                            )
                        {
                            continue;
                        }

                        BusinessObject currentBO = null; string resultOp = "update";
                        switch (crudNode.Name)
                        {
                        case "update":
                            // updates can affect more than one Business Object by a wider condition
                            foreach (var updateReturnItem in crudNode.SelectNodes("return").OfType <XmlNode>())
                            {
                                currentBO     = new BusinessObject(currentCRUDOp.Item2);
                                currentBO.Uid = RecordUid.From(
                                    updateReturnItem.Attributes["table"].Value,
                                    RecordId.FromString(updateReturnItem.Attributes["id"].Value)
                                    );
                            }
                            break;

                        case "import":
                            resultOp = crudNode.FirstChild.Attributes["type"].Value;
                            if (resultOp == "match") // if nothing has been updated or created
                            {
                                continue;
                            }

                            currentBO     = new BusinessObject(currentCRUDOp.Item2);
                            currentBO.Uid = RecordUid.From(
                                crudNode.FirstChild.Attributes["table"].Value,
                                RecordId.FromString(crudNode.FirstChild.Attributes["id"].Value)
                                );

                            break;
                        }

                        Log.Current.Debug(logFac, "Checking if the BusinessObject for event is valid...");
                        if (currentBO == null || !currentBO.Uid.IsValid)
                        {
                            continue;
                        }

                        Log.Current.DebugFormat(logFac, ">{0}< event will be fired on {1}", resultOp, currentBO.ToPrettyString());

                        // Fire event
                        switch (resultOp)
                        {
                        case "update":
                            eventHub.RaiseEvent(
                                string.Format("/InfoAreas/{0}/PostUpdate", currentBO.Uid.InfoAreaId),
                                this,
                                new UpdateEventArgs(suServices)
                            {
                                BusinessObject = currentBO
                            }
                                );
                            break;

                        case "insert":
                            eventHub.RaiseEvent(
                                string.Format("/InfoAreas/{0}/PostNew", currentBO.Uid.InfoAreaId),
                                this,
                                new NewEventArgs(suServices)
                            {
                                BusinessObject = currentBO
                            }
                                );
                            break;
                        }

                        Log.Current.Debug(logFac, "Successfully finished firing the event!");
                    }
                }

            Log.Current.Debug(logFac, "Execution has finished!");
        }
예제 #31
0
 public abstract void GetBy(BusinessObject sender, BusinessConsultEventArgs args);
예제 #32
0
        public string GenerateClass(BusinessObject bo)
        {
            var rst = new StringBuilder();

            rst.AppendLine($"namespace {bo.Category.FullName}{{");
            rst.AppendLine("//BO:" + bo.Oid);
            if (!bo.IsPersistent)
            {
                rst.AppendLine("[NonPersistent]");
            }

            if (bo.IsCloneable.HasValue && bo.IsCloneable.Value)
            {
                rst.AppendLine("[ModelDefault(\"Cloneable\",\"True\")]");
            }
            if (bo.IsCreatableItem.HasValue && bo.IsCreatableItem.Value)
            {
                rst.AppendLine("[ModelDefault(\"Createable\",\"True\")]");
            }
            if (bo.IsVisibileInReports.HasValue && bo.IsVisibileInReports.Value)
            {
                rst.AppendLine("[VisibleInReport]");
            }

            rst.AppendLine($"public { (bo.CanInherits ? "" : "sealed") + (bo.IsAbstract ? "abstract" : "") } class { bo.名称 } : ");

            if (bo.Base.IsGenericTypeDefine)
            {
                var n = bo.Base.FullName;
                rst.Append(n.Substring(0, n.Length - 2));
                rst.AppendFormat("<{0}>", string.Join(",", bo.GenericParameters.Select(x => x.ParameterValue.FullName).ToArray()));
            }
            else
            {
                rst.Append(bo.Base.FullName);
            }
            //begin class
            rst.AppendLine("{");

            rst.AppendLine($"   public {bo.名称}(Session s):base(s){{  }}");

            foreach (var item in bo.Properties)
            {
                rst.AppendLine($"{ item.PropertyType.FullName } _{ item.名称 };");

                if (item.Size != 100 && item.Size != 0)
                {
                    rst.AppendLine($"[Size({item.Size})]");
                }

                rst.AppendLine($"public { item.PropertyType.FullName } { item.名称 }");
                rst.AppendLine("{");
                rst.AppendLine("get");
                rst.AppendLine("{");
                rst.AppendLine($"    return _{item.名称};");
                rst.AppendLine("}");
                rst.AppendLine("set");
                rst.AppendLine("{");
                rst.AppendLine($"SetPropertyValue(\"{item.名称}\",ref _{item.名称},value);");
                rst.AppendLine("}");
                rst.AppendLine("}");
            }

            foreach (var item in bo.CollectionProperties)
            {
                if (item.Aggregated)
                {
                    rst.AppendLine("[DevExpress.Xpo.Aggrgated]");
                }
                rst.AppendLine($"public XpCollection<{item.PropertyType.FullName}> {item.名称}{{ get{{ return GetCollection<{item.PropertyType.FullName}>(\"{item.名称}\"); }} }}");
            }

            foreach (var method in bo.Methods)
            {
                rst.Append(method.MethodDefineCode);
            }

            //end class
            rst.AppendLine("}");
            rst.AppendLine("}");

            return rst.ToString();
        }
예제 #33
0
 /// <summary>
 /// Constructs the new transactionlogTable with default table name and logging fields and a specific security controller for getting the currently logged on user.
 /// </summary>
 /// <param name="busObjToLog"></param>
 /// <param name="securityController"></param>
 public TransactionLogTable(BusinessObject busObjToLog,ISecurityController securityController)
     : this(busObjToLog, securityController, "transactionLog")
 {
 }
예제 #34
0
 public GenericController(BusinessObject <T> businessObject, Message message)
 {
     _businessObject = businessObject;
     _message        = message;
 }
예제 #35
0
 public abstract bool Validate(BusinessObject businessObject);
예제 #36
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ComposeEmail"></param>
        /// <returns></returns>
        public bool SendEmail(ComposeEmail ComposeEmail)
        {
            EmailDomain      EmailDomain   = new EmailDomain();
            tblUser          userfrom      = bringlyEntities.tblUsers.Where(x => x.UserGuid == UserVariables.LoggedInUserGuid).ToList().FirstOrDefault();
            tblEmailTemplate template      = new tblEmailTemplate();
            BusinessObject   tblBusiness   = new BusinessObject();
            string           image         = "<img src = " + CommonDomainLogic.GetCurrentDomain + CommonDomainLogic.GetImagePath(ImageType.Default, "") + ">";
            string           UserImageName = userfrom.ImageName;
            int count = 0;

            if (ComposeEmail.EmailToGuid != null && ComposeEmail.EmailToGuid.Count() > 0)
            {
                foreach (string usertoguid in ComposeEmail.EmailToGuid)
                {
                    tblUser userto = bringlyEntities.tblUsers.Where(x => x.UserGuid == new Guid(usertoguid)).ToList().FirstOrDefault();
                    EmailDomain.EmailTo = userto.EmailAddress;
                    template            = !string.IsNullOrEmpty(ComposeEmail.EmailMessage.TemplateType) ? bringlyEntities.tblEmailTemplates
                                          .Where(x => x.TemplateType == ComposeEmail.EmailMessage.TemplateType).ToList().FirstOrDefault() : new tblEmailTemplate();
                    if (template != null && template.TemplateGuid != null && template.TemplateGuid != Guid.Empty)
                    {
                        EmailDomain.EmailFrom    = userfrom.EmailAddress;
                        EmailDomain.EmailSubject = ComposeEmail.EmailMessage.Subject;
                        if (!ComposeEmail.Isemailreplyorforward)
                        {
                            tblBusiness = bringlyEntities.tblBusinesses.Where(x => x.FK_CreatedByGuid == UserVariables.LoggedInUserGuid).
                                          Select(s => new BusinessObject {
                                BusinessImage = s.BusinessImage, BusinessName = s.BusinessName
                            }).ToList().FirstOrDefault();
                            EmailDomain.EmailBody = template.Body;
                            EmailDomain.EmailBody = EmailDomain.EmailBody.Replace("{ToName}", userto.FullName).Replace("{Description}", ComposeEmail.EmailMessage.Body)
                                                    .Replace("{FromName}", userfrom.FullName);
                        }
                        else
                        {
                            EmailDomain.EmailBody = ComposeEmail.EmailMessage.Body;
                        }

                        string emailSendResult = EmailSender.sendEmail(EmailDomain);
                        if (!string.IsNullOrEmpty(emailSendResult))
                        {
                            ErrorLog.LogError(emailSendResult, "send email Error");
                        }

                        tblEmail tblEmail = new tblEmail();
                        tblEmail.EmailGuid        = Guid.NewGuid();
                        tblEmail.EmailFrom        = EmailDomain.EmailFrom;
                        tblEmail.Subject          = EmailDomain.EmailSubject;
                        tblEmail.Body             = EmailDomain.EmailBody;
                        tblEmail.Sent             = (emailSendResult == "") ? true : false;
                        tblEmail.FK_TemplateGuid  = template.TemplateGuid;
                        tblEmail.DateCreated      = DateTime.Now;
                        tblEmail.FK_CreatedByGuid = UserVariables.LoggedInUserGuid;
                        bringlyEntities.tblEmails.Add(tblEmail);
                        if (tblEmail.Sent)
                        {
                            tblEmailTo tblEmailTo = new tblEmailTo();

                            tblEmailTo.EmailToGuid  = Guid.NewGuid();
                            tblEmailTo.FK_EmailGuid = tblEmail.EmailGuid;
                            tblEmailTo.EmailTo      = EmailDomain.EmailTo;
                            tblEmailTo.FK_UserGuid  = new Guid(usertoguid);// new Guid(usertoguid);
                            bringlyEntities.tblEmailToes.Add(tblEmailTo);
                        }
                        bringlyEntities.SaveChanges();
                        count = count + ((emailSendResult == "") ? 0 : 1);
                    }
                }
            }
            else
            {
                count++;
            }

            if (count > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #37
0
        private List <BusinessObject> GetDefaultDataSource()
        {
            List <BusinessObject> BusinessObjectCollection = new List <BusinessObject>();
            BusinessObject        Record1 = null;

            Record1 = new BusinessObject()
            {
                TaskId    = 1,
                TaskName  = "Planning",
                StartDate = "02/03/2014",
                EndDate   = "02/07/2014",
                Progress  = 100,
                Duration  = 5,
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Child1 = new BusinessObject()
            {
                TaskId    = 2,
                TaskName  = "Plan timeline",
                StartDate = "02/03/2014",
                EndDate   = "02/07/2014",
                Duration  = 5,
                Progress  = 100
            };
            BusinessObject Child2 = new BusinessObject()
            {
                TaskId    = 3,
                TaskName  = "Plan budget",
                StartDate = "02/03/2014",
                EndDate   = "02/07/2014",
                Duration  = 5,
                Progress  = 100
            };
            BusinessObject Child3 = new BusinessObject()
            {
                TaskId    = 4,
                TaskName  = "Allocate resources",
                StartDate = "02/03/2014",
                EndDate   = "02/07/2014",
                Duration  = 5,
                Progress  = 100
            };
            BusinessObject Child4 = new BusinessObject()
            {
                TaskId    = 5,
                TaskName  = "Planning complete",
                StartDate = "02/07/2014",
                EndDate   = "02/07/2014",
                Duration  = 0,
                Progress  = 0
            };

            Record1.Children.Add(Child1);
            Record1.Children.Add(Child2);
            Record1.Children.Add(Child3);
            Record1.Children.Add(Child4);
            BusinessObject Record2 = new BusinessObject()
            {
                TaskId    = 6,
                TaskName  = "Design",
                StartDate = "02/10/2014",
                EndDate   = "02/14/2014",
                Progress  = 86,
                Duration  = 3,
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Child5 = new BusinessObject()
            {
                TaskId    = 7,
                TaskName  = "Software Specification",
                StartDate = "02/10/2014",
                EndDate   = "02/12/2014",
                Duration  = 3,
                Progress  = 60
            };
            BusinessObject Child6 = new BusinessObject()
            {
                TaskId    = 8,
                TaskName  = "Develop prototype",
                StartDate = "02/10/2014",
                EndDate   = "02/12/2014",
                Duration  = 3,
                Progress  = 100
            };
            BusinessObject Child7 = new BusinessObject()
            {
                TaskId    = 9,
                TaskName  = "Get approval from customer",
                StartDate = "02/13/2014",
                EndDate   = "02/14/2014",
                Duration  = 2,
                Progress  = 100
            };
            BusinessObject Child8 = new BusinessObject()
            {
                TaskId    = 10,
                TaskName  = "Design complete",
                StartDate = "02/14/2014",
                EndDate   = "02/14/2014",
                Duration  = 0,
                Progress  = 0
            };

            Record2.Children.Add(Child5);
            Record2.Children.Add(Child6);
            Record2.Children.Add(Child7);
            Record2.Children.Add(Child8);
            BusinessObjectCollection.Add(Record1);
            BusinessObjectCollection.Add(Record2);
            return(BusinessObjectCollection);
        }
예제 #38
0
        protected override void btnSave_Click(object sender, EventArgs e)
        {
            #region 保存数据
            if (this.m_bOpState == BusiOpState.AddBusiData || this.m_bOpState == BusiOpState.EditBusiData)
            {
                if (this.m_dvM[this.dgM.CurrentRowIndex]["UserName"].ToString().Trim() == "")
                {
                    MsgBox.ShowInfoMsg2("用户名不可为空!");
                    if (this.tabCtlMain.SelectedIndex != 1)
                    {
                        this.tabCtlMain.SelectedIndex = 1;
                    }
                    this.txtWUserName.Clear(); this.txtWUserName.Focus(); return;
                }

                if (this.m_dvM[this.dgM.CurrentRowIndex]["UserName"].ToString().Trim().ToLower() == "admin".ToLower())
                {
                    MsgBox.ShowInfoMsg2("admin 不可使用!\nadmin 为系统内置用户名!");
                    if (this.tabCtlMain.SelectedIndex != 1)
                    {
                        this.tabCtlMain.SelectedIndex = 1;
                    }
                    this.txtWUserName.Clear(); this.txtWUserName.Focus(); return;
                }

                if (this.m_dvM[this.dgM.CurrentRowIndex]["PersonCode"].ToString().Trim() == "")
                {
                    MsgBox.ShowInfoMsg2("职员不可为空!");
                    if (this.tabCtlMain.SelectedIndex != 1)
                    {
                        this.tabCtlMain.SelectedIndex = 1;
                    }
                    this.txtSPsnCode.Clear(); this.txtSPsnCode.Focus(); return;
                }

                #region 检查用户编码
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    string s = "select count(*) as RSCount from UserInfo with(updlock) where ";
                    s += "UserName='******'";
                    s += " and ";
                    s += "UserId!=" + this.m_dvM[this.dgM.CurrentRowIndex]["UserId"].ToString();

                    BusinessObject bo = new BusinessObject();
                    bo.BusiDataSQL = new string[] { s };

                    bo.GetBusiData();
                    if (bo.BusiMsg[0] == "0")
                    {
                        MsgBox.ShowInfoMsg2(bo.BusiMsg[1]); return;
                    }
                    else if (bo.BusiMsg[0] == "1")
                    {
                        if ((int)bo.BusiData.Tables[0].Rows[0][0] > 0)
                        {
                            MsgBox.ShowInfoMsg2("用户编码已经存在!"); this.txtWUserName.Focus(); return;
                        }
                    }
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
                #endregion
            }

            base.btnSave_Click(sender, e);
            #endregion
        }
예제 #39
0
 /// <summary>
 /// Gets value for given business object's property using reflection.
 /// </summary>
 /// <param name="businessObject"></param>
 /// <param name="propertyName"></param>
 /// <returns></returns>
 protected object GetPropertyValue(BusinessObject businessObject)
 {
     return(businessObject.GetType().GetProperty(PropertyName).GetValue(businessObject, null));
 }
예제 #40
0
 public PaymentSettlement(BusinessObject parent)
     : base(parent, BusinessObjectType.PaymentSettlement)
 {
     this.Date = SessionManager.VolatileElements.CurrentDateTime;
 }
예제 #41
0
        private void BuildControls(BusinessObject b, bool retrieveValues)
        {
            // get panels and labels
            var parentRptr  = Page.FindControl("ParentRptr") as Repeater;
            var parentPanel = Page.FindControl("ParentFieldsPanel") as Control;
            var parentLabel = Page.FindControl("ParentFieldsLabel") as Label;
            var mainLabel   = Page.FindControl("MainFieldsLabel") as Label;
            var childPanel  = Page.FindControl("ChildFieldsPanel") as Control;;
            var childLabel  = Page.FindControl("ChildFieldsLabel") as Label;

            Repeater childTablesRptr       = Page.FindControl("ChildTablesRptr") as Repeater;
            Repeater childTablesHeaderRptr = Page.FindControl("ChildTablesHeaderRptr") as Repeater;

            // BUILD: parent table
            if (parent != null)
            {
                string parentTable = parent.TableName;
                // validate container
                if (parentPanel != null)
                {
                    // show relevant sections
                    parentPanel.Visible = true;
                    parentLabel.Visible = true;
                    mainLabel.Visible   = true;

                    // set title
                    parentLabel.Text = GetTableLabel(parentTable);

                    // get parent fields
                    List <ICaisisInputControl> parentInputFields = GetInputControls(parentTable);

                    // build controls
                    parentRptr.DataSource = parentInputFields;
                    parentRptr.DataBind();

                    if (retrieveValues)
                    {
                        SetFieldValues(parent, parentInputFields);
                    }
                }
            }
            // BUILD: main table

            // need to branch here if containers are repeaters (should be split into methods too)
            List <ICaisisInputControl> mainInputFields = GetInputControls(b.TableName);
            List <ICaisisInputControl> mainFields      = new List <ICaisisInputControl>();
            List <ICaisisInputControl> hiddenFields    = new List <ICaisisInputControl>();

            foreach (ICaisisInputControl iCIC in mainInputFields)
            {
                if (!hideSelectedFields)
                {
                    if (selectedFields.Length == 0 || selectedFields.Contains(iCIC.Field))
                    {
                        mainFields.Add(iCIC);
                    }
                    else
                    {
                        hiddenFields.Add(iCIC);
                    }
                }
                else
                {
                    if (selectedFields.Contains(iCIC.Field))
                    {
                        hiddenFields.Add(iCIC);
                    }
                    else
                    {
                        mainFields.Add(iCIC);
                    }
                }
            }

            if (mainContainer is Repeater)
            {
                Repeater mainRpt   = (Repeater)mainContainer;
                Repeater hiddenRpt = (Repeater)hiddenContainer;

                mainRpt.DataSource   = mainFields;
                hiddenRpt.DataSource = hiddenFields;

                mainRpt.DataBind();
                hiddenRpt.DataBind();
            }
            else
            {
                DynamicControlContainer mainWrapper   = new DynamicControlContainer(mainContainer);
                DynamicControlContainer hiddenWrapper = new DynamicControlContainer(hiddenContainer);

                foreach (Control c in mainFields.OfType <Control>())
                {
                    mainWrapper.AddChildControl(c);
                }
                foreach (Control c in hiddenFields.OfType <Control>())
                {
                    hiddenWrapper.AddChildControl(c);
                }
            }
            if (retrieveValues)
            {
                SetFieldValues(bizo, mainInputFields);
            }
            // set main title
            mainLabel.Text = GetTableLabel(b.TableName);

            // BUILD: child tables
            if (childTablesRptr != null && ChildTableNames.Length > 0)
            {
                // show child fields
                childPanel.Visible = true;
                mainLabel.Visible  = true;

                // build child table headers
                childTablesHeaderRptr.DataSource = ChildTableNames;
                childTablesHeaderRptr.DataBind();

                // build child table data entry
                childTablesRptr.DataSource = ChildTableNames;
                childTablesRptr.DataBind();
            }
        }
예제 #42
0
        protected override void DataReaderToPersistentObject(System.Data.IDataReader dataReader, BusinessObject businessObject, string radical)
        {
            Parametro param = (Parametro)businessObject;

            param.BeginInit();
            try
            {
                param.tipoAmbiente = (TAmb)Utils.FieldAsInt32(dataReader, "TipoOperacao");
                param.tipoEmissao  = (TNFeInfNFeIdeTpEmis)Utils.FieldAsInt32(dataReader, "ModoOperacao");
                param.UF           = (TCodUfIBGE)Utils.FieldAsInt32(dataReader, "UnidadeFederativa");
                param.timeout      = (Delay)Utils.FieldAsInt32(dataReader, "TimeOut");

                param.empresa = Utils.FieldAsString(dataReader, "CNPJ");

                param.qtdeNotasPorLotes = Utils.FieldAsInt32(dataReader, "QtdeNFLote");
                param.tempoParaLote     = Utils.FieldAsInt32(dataReader, "TempoFechaLote");
                param.tamMaximoLoteKB   = Utils.FieldAsInt32(dataReader, "TamanhoLote");
                param.tempoEspera       = Utils.FieldAsInt32(dataReader, "TempoEspera");

                param.pastaRecibo    = Utils.FieldAsString(dataReader, "DiretorioRecibo");
                param.pastaEntrada   = Utils.FieldAsString(dataReader, "DiretorioEntrada");
                param.pastaSaida     = Utils.FieldAsString(dataReader, "DiretorioSaida");
                param.pastaImpressao = Utils.FieldAsString(dataReader, "DiretorioImpressao");
                param.pastaXSD       = Utils.FieldAsString(dataReader, "DiretorioXSD");

                param.prx         = Utils.FieldAsBoolean(dataReader, "UsaProxy");
                param.prxDmn      = Utils.FieldAsString(dataReader, "DominioProxy");
                param.prxPsw      = Utils.FieldAsString(dataReader, "SenhaProxy");
                param.prxUrl      = Utils.FieldAsString(dataReader, "UrlProxy");
                param.prxUsr      = Utils.FieldAsString(dataReader, "UsuarioProxy");
                param.certificado = Utils.FieldAsString(dataReader, "NomeCertificado");
                param.usaWService = Utils.FieldAsBoolean(dataReader, "WService");
                param.versao      = (VersaoXML)Utils.FieldAsInt32(dataReader, "versao");

                param.isRecorded = true;
                param.isModified = false;
            }
            finally
            {
                param.EndInit();
            }
        }
예제 #43
0
 public override bool Validate(BusinessObject businessObject)
 {
     return(Regex.Match(GetPropertyValue(businessObject).ToString(), Pattern).Success);
 }
예제 #44
0
 public ITransactionLog GetLogger(BusinessObject bo)
 {
     return new TransactionLogTable(bo);
 }
예제 #45
0
 public EmployeeHistoriesController(BusinessObject <EmployeeHistory> businessObject, Message message) :
     base(businessObject, message)
 {
 }
예제 #46
0
        public static String GenerateNo(BusinessObject obj)
        {
            if (obj.GetID() == Guid.Empty)
            {
                obj.SetNoValue(String.Empty);
                return(String.Empty);
            }

            String strNoValue = String.Empty;

            Numbering numbering = GetNumberingConfig(obj);

            if (numbering != null)
            {
                if (!numbering.IsUsePattern)
                {
                    #region Not UsePattern
                    if (numbering.MiddleConfigs.Count > 0)
                    {
                        #region Have Parts
                        List <String> lstParts = new List <string>();
                        foreach (NumberingType numberType in numbering.MiddleConfigs)
                        {
                            #region Others
                            if (numberType.IsByUser)
                            {
                            }
                            if (numberType.IsByUserGroup)
                            {
                            }
                            if (numberType.IsByEmployee)
                            {
                            }
                            if (numberType.IsByCompanyUnit)
                            {
                            }
                            #endregion

                            if ((numberType.IsYYMMCount || numberType.IsYYMMDDCount || numberType.IsMMDDCount))
                            {
                                String strDateCol = String.Empty;
                                if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colCreateTime))
                                {
                                    strDateCol = ABCCommon.ABCConstString.colCreateTime;
                                }
                                if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colDocumentDate))
                                {
                                    strDateCol = ABCCommon.ABCConstString.colDocumentDate;
                                }

                                if (!String.IsNullOrWhiteSpace(strDateCol))
                                {
                                    object objValue = ABCDynamicInvoker.GetValue(obj, strDateCol);
                                    if (objValue != null && (objValue is DateTime || (objValue is Nullable <DateTime> && (objValue as Nullable <DateTime>).HasValue)))
                                    {
                                        #region With DateTime
                                        DateTime createTime = DateTime.MinValue;
                                        if (objValue is Nullable <DateTime> )
                                        {
                                            createTime = (objValue as Nullable <DateTime>).Value;
                                        }
                                        else
                                        {
                                            createTime = Convert.ToDateTime(objValue);
                                        }

                                        if (numberType.IsYYMMCount)
                                        {
                                            String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                                            strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND {0} < {3}", strDateCol, createTime.Year, createTime.Month, TimeProvider.GenDateTimeString(createTime)));
                                            int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                                            if (iCount <= 0)
                                            {
                                                iCount = 0;
                                            }
                                            iCount++;


                                            int iCountSpace = numberType.CountingSpace;
                                            if (iCountSpace < iCount.ToString().Length)
                                            {
                                                iCountSpace = iCount.ToString().Length + 2;
                                            }

                                            String strTemp = createTime.ToString("yyMM") + String.Format("{0:D" + iCountSpace + "}", iCount);
                                            lstParts.Add(strTemp);
                                        }
                                        if (numberType.IsYYMMDDCount)
                                        {
                                            String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                                            strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND DAY({0}) = {3} AND {0} < {4}", strDateCol, createTime.Year, createTime.Month, createTime.Day, TimeProvider.GenDateTimeString(createTime)));
                                            int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                                            if (iCount <= 0)
                                            {
                                                iCount = 0;
                                            }
                                            iCount++;

                                            int iCountSpace = numberType.CountingSpace;
                                            if (iCountSpace < iCount.ToString().Length)
                                            {
                                                iCountSpace = iCount.ToString().Length + 2;
                                            }

                                            String strTemp = createTime.ToString("yyMMdd") + String.Format("{0:D" + iCountSpace + "}", iCount);
                                            lstParts.Add(strTemp);
                                        }
                                        if (numberType.IsMMDDCount)
                                        {
                                            String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                                            strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND DAY({0}) = {3} AND {0} < {4}", strDateCol, createTime.Year, createTime.Month, createTime.Day, TimeProvider.GenDateTimeString(createTime)));
                                            int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                                            if (iCount <= 0)
                                            {
                                                iCount = 0;
                                            }
                                            iCount++;

                                            int iCountSpace = numberType.CountingSpace;
                                            if (iCountSpace < iCount.ToString().Length)
                                            {
                                                iCountSpace = iCount.ToString().Length + 2;
                                            }

                                            String strTemp = createTime.ToString("MMdd") + String.Format("{0:D" + iCountSpace + "}", iCount);
                                            lstParts.Add(strTemp);
                                        }
                                        #endregion
                                    }
                                }
                            }

                            #region By Field
                            if (numberType.IsByField && !String.IsNullOrWhiteSpace(numberType.FieldName))
                            {
                                if (DataStructureProvider.IsTableColumn(obj.AATableName, numberType.FieldName))
                                {
                                    object objValue = ABCDynamicInvoker.GetValue(obj, numberType.FieldName);
                                    if (objValue != null)
                                    {
                                        if (DataStructureProvider.IsForeignKey(obj.AATableName, numberType.FieldName))
                                        {
                                            String strFieldName = numberType.FieldName + ":" + DataStructureProvider.GetDisplayColumn(obj.AATableName);
                                            objValue = DataCachingProvider.GetCachingObjectAccrossTable(obj, ABCHelper.DataConverter.ConvertToGuid(objValue), strFieldName);
                                        }

                                        lstParts.Add(objValue.ToString());
                                    }
                                }
                            }
                            #endregion
                        }

                        strNoValue = numbering.Prefix + String.Join(numbering.SeperateChar, lstParts) + numbering.Suffix;

                        #endregion
                    }
                    else
                    {
                        String strDateCol = String.Empty;
                        if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colCreateTime))
                        {
                            strDateCol = ABCCommon.ABCConstString.colCreateTime;
                        }
                        if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colDocumentDate))
                        {
                            strDateCol = ABCCommon.ABCConstString.colDocumentDate;
                        }

                        if (!String.IsNullOrWhiteSpace(strDateCol))
                        {
                            object objValue = ABCDynamicInvoker.GetValue(obj, strDateCol);
                            if (objValue != null && (objValue is DateTime || (objValue is Nullable <DateTime> && (objValue as Nullable <DateTime>).HasValue)))
                            {
                                #region With DateTime
                                DateTime createTime = DateTime.MinValue;
                                if (objValue is Nullable <DateTime> )
                                {
                                    createTime = (objValue as Nullable <DateTime>).Value;
                                }
                                else
                                {
                                    createTime = Convert.ToDateTime(objValue);
                                }

                                String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                                strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND {0} < {3}", strDateCol, createTime.Year, createTime.Month, TimeProvider.GenDateTimeString(createTime)));
                                int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                                if (iCount <= 0)
                                {
                                    iCount = 0;
                                }
                                iCount++;

                                int iCountSpace = 3;
                                if (iCountSpace < iCount.ToString().Length)
                                {
                                    iCountSpace = iCount.ToString().Length + 2;
                                }

                                strNoValue = numbering.Prefix + createTime.ToString("yyMM") + String.Format("{0:D" + iCountSpace + "}", iCount) + numbering.Suffix;

                                #endregion
                            }
                        }
                        else if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colNoIndex))
                        {
                            int iNoIndex    = Convert.ToInt32(ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colNoIndex));
                            int iCountSpace = 4;
                            if (iNoIndex >= 10000)
                            {
                                iCountSpace = iNoIndex.ToString().Length + 2;
                            }
                            strNoValue = numbering.Prefix + String.Format("{0:D" + iCountSpace + "}", iNoIndex) + numbering.Suffix;
                        }
                    }
                    #endregion
                }
                else
                {
                    #region UsePattern

                    #endregion
                }
            }
            else
            {
                #region Have No Config
                if (!String.IsNullOrWhiteSpace(DataConfigProvider.TableConfigList[obj.AATableName].PrefixNo))
                {
                    strNoValue = DataConfigProvider.TableConfigList[obj.AATableName].PrefixNo;
                }
                else
                {
                    strNoValue = new Regex("[^A-Z]+").Replace(DataConfigProvider.GetTableCaption(obj.AATableName), "");
                }


                String strDateCol = String.Empty;
                if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colCreateTime))
                {
                    strDateCol = ABCCommon.ABCConstString.colCreateTime;
                }
                if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colDocumentDate))
                {
                    strDateCol = ABCCommon.ABCConstString.colDocumentDate;
                }

                if (!String.IsNullOrWhiteSpace(strDateCol))
                {
                    object objValue = ABCDynamicInvoker.GetValue(obj, strDateCol);
                    if (objValue != null && (objValue is DateTime || (objValue is Nullable <DateTime> && (objValue as Nullable <DateTime>).HasValue)))
                    {
                        #region With DateTime
                        DateTime createTime = DateTime.MinValue;
                        if (objValue is Nullable <DateTime> )
                        {
                            createTime = (objValue as Nullable <DateTime>).Value;
                        }
                        else
                        {
                            createTime = Convert.ToDateTime(objValue);
                        }

                        String strQuery = QueryGenerator.GenSelect(obj.AATableName, "COUNT(*)", false, false);
                        strQuery = QueryGenerator.AddCondition(strQuery, String.Format(@" YEAR({0}) = {1} AND MONTH({0}) = {2} AND {0} < {3}", strDateCol, createTime.Year, createTime.Month, TimeProvider.GenDateTimeString(createTime)));
                        int iCount = Convert.ToInt32(BusinessObjectController.GetData(strQuery));
                        if (iCount <= 0)
                        {
                            iCount = 0;
                        }
                        iCount++;

                        int iCountSpace = 3;
                        if (iCountSpace < iCount.ToString().Length)
                        {
                            iCountSpace = iCount.ToString().Length + 2;
                        }

                        strNoValue += createTime.ToString("yyMM") + String.Format("{0:D" + iCountSpace + "}", iCount);

                        #endregion
                    }
                }
                else if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colNoIndex))
                {
                    int iNoIndex    = Convert.ToInt32(ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colNoIndex));
                    int iCountSpace = 4;
                    if (iNoIndex >= 10000)
                    {
                        iCountSpace = iNoIndex.ToString().Length + 2;
                    }
                    strNoValue += String.Format("{0:D" + iCountSpace + "}", iNoIndex);
                }

                #endregion
            }

            obj.SetNoValue(strNoValue);
            return(strNoValue);
        }
예제 #47
0
        private List <BusinessObject> GetImplementationDataSource()
        {
            List <BusinessObject> BusinessObjectCollection = new List <BusinessObject>();
            BusinessObject        Record1 = new BusinessObject()
            {
                TaskId    = 1,
                TaskName  = "Implementation Phase",
                StartDate = "02/17/2017",
                EndDate   = "02/17/2017",
                Children  = new List <BusinessObject>(),
            };

            BusinessObject Record2 = new BusinessObject()
            {
                TaskId    = 2,
                TaskName  = "Phase 1",
                StartDate = "02/17/2017",
                EndDate   = "02/27/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Record5 = new BusinessObject()
            {
                TaskId    = 3,
                TaskName  = "Implementation Module 1",
                StartDate = "02/17/2017",
                EndDate   = "02/27/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Child1 = new BusinessObject()
            {
                TaskId    = 4,
                TaskName  = "Development Task 1",
                StartDate = "02/17/2017",
                EndDate   = "02/19/2017",
                Duration  = 3,
                Progress  = 50
            };
            BusinessObject Child2 = new BusinessObject()
            {
                TaskId    = 5,
                TaskName  = "Development Task 2",
                StartDate = "02/17/2017",
                EndDate   = "02/19/2017",
                Duration  = 3,
                Progress  = 50
            };
            BusinessObject Child3 = new BusinessObject()
            {
                TaskId    = 6,
                TaskName  = "Testing",
                StartDate = "02/20/2017",
                EndDate   = "02/21/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child4 = new BusinessObject()
            {
                TaskId    = 7,
                TaskName  = "Bug fix",
                StartDate = "02/24/2017",
                EndDate   = "02/25/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child5 = new BusinessObject()
            {
                TaskId    = 8,
                TaskName  = "Customer review meeting",
                StartDate = "02/26/2017",
                EndDate   = "02/27/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child6 = new BusinessObject()
            {
                TaskId    = 9,
                TaskName  = "Phase 1 complete",
                StartDate = "02/27/2017",
                EndDate   = "02/27/2017",
                Duration  = 2,
                Progress  = 0
            };

            Record5.Children.Add(Child1);
            Record5.Children.Add(Child2);
            Record5.Children.Add(Child3);
            Record5.Children.Add(Child4);
            Record5.Children.Add(Child5);
            Record5.Children.Add(Child6);
            Record2.Children.Add(Record5);
            Record1.Children.Add(Record2);
            BusinessObject Record3 = new BusinessObject()
            {
                TaskId    = 10,
                TaskName  = "Phase 2",
                StartDate = "02/17/2017",
                EndDate   = "02/28/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Record6 = new BusinessObject()
            {
                TaskId    = 11,
                TaskName  = "Implementation Module 2",
                StartDate = "02/17/2017",
                EndDate   = "02/28/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Child7 = new BusinessObject()
            {
                TaskId    = 12,
                TaskName  = "Development Task 1",
                StartDate = "02/17/2017",
                EndDate   = "02/20/2017",
                Duration  = 4,
                Progress  = 50
            };
            BusinessObject Child8 = new BusinessObject()
            {
                TaskId    = 13,
                TaskName  = "Development Task 2",
                StartDate = "02/17/2017",
                EndDate   = "02/20/2017",
                Duration  = 4,
                Progress  = 50
            };
            BusinessObject Child9 = new BusinessObject()
            {
                TaskId    = 14,
                TaskName  = "Testing",
                StartDate = "02/21/2017",
                EndDate   = "02/24/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child10 = new BusinessObject()
            {
                TaskId    = 15,
                TaskName  = "Bug fix",
                StartDate = "02/25/2017",
                EndDate   = "02/26/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child11 = new BusinessObject()
            {
                TaskId    = 16,
                TaskName  = "Customer review meeting",
                StartDate = "02/27/2017",
                EndDate   = "02/28/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child12 = new BusinessObject()
            {
                TaskId    = 17,
                TaskName  = "Phase 1 complete",
                StartDate = "02/28/2017",
                EndDate   = "02/28/2017",
                Duration  = 2,
            };

            Record6.Children.Add(Child7);
            Record6.Children.Add(Child8);
            Record6.Children.Add(Child9);
            Record6.Children.Add(Child10);
            Record6.Children.Add(Child11);
            Record6.Children.Add(Child12);
            Record3.Children.Add(Record6);
            Record1.Children.Add(Record3);
            BusinessObject Record4 = new BusinessObject()
            {
                TaskId    = 18,
                TaskName  = "Phase 3",
                StartDate = "02/17/2017",
                EndDate   = "02/27/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Record7 = new BusinessObject()
            {
                TaskId    = 19,
                TaskName  = "Implementation Module 3",
                StartDate = "02/17/2017",
                EndDate   = "02/27/2017",
                Children  = new List <BusinessObject>(),
            };
            BusinessObject Child13 = new BusinessObject()
            {
                TaskId    = 20,
                TaskName  = "Development Task 1",
                StartDate = "02/17/2017",
                EndDate   = "02/19/2017",
                Duration  = 3,
                Progress  = 50
            };
            BusinessObject Child14 = new BusinessObject()
            {
                TaskId    = 21,
                TaskName  = "Development Task 2",
                StartDate = "02/17/2017",
                EndDate   = "02/19/2017",
                Duration  = 3,
                Progress  = 50
            };
            BusinessObject Child15 = new BusinessObject()
            {
                TaskId    = 22,
                TaskName  = "Testing",
                StartDate = "02/20/2017",
                EndDate   = "02/21/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child16 = new BusinessObject()
            {
                TaskId    = 23,
                TaskName  = "Bug fix",
                StartDate = "02/24/2017",
                EndDate   = "02/25/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child17 = new BusinessObject()
            {
                TaskId    = 24,
                TaskName  = "Customer review meeting",
                StartDate = "02/26/2017",
                EndDate   = "02/27/2017",
                Duration  = 2,
                Progress  = 0
            };
            BusinessObject Child18 = new BusinessObject()
            {
                TaskId    = 25,
                TaskName  = "Phase 1 complete",
                StartDate = "02/27/2017",
                EndDate   = "02/27/2017",
                Duration  = 2,
            };

            Record7.Children.Add(Child13);
            Record7.Children.Add(Child14);
            Record7.Children.Add(Child15);
            Record7.Children.Add(Child16);
            Record7.Children.Add(Child17);
            Record7.Children.Add(Child18);
            Record4.Children.Add(Record7);
            Record1.Children.Add(Record4);
            BusinessObjectCollection.Add(Record1);

            return(BusinessObjectCollection);
        }
예제 #48
0
파일: SfcOp.cs 프로젝트: fightx/U8
        public virtual Model.DealResult LoadVouch(Model.APIData bd, Model.Synergismlogdt dt, out BusinessObject domHead, out BusinessObject domBody)
        {
            domHead = null;
            domBody = null;
            Model.DealResult dr           = new Model.DealResult();
            Model.APIData    apidata      = bd as Model.APIData;
            string           vouchid      = GetCodeorID(dt.Cvoucherno, apidata, "id");
            string           auditaddress = SetApiAddressLoad();

            U8Login.clsLogin u8Login = new U8Login.clsLogin();
            GetU8Login(apidata, u8Login);
            U8ApiBroker broker = null;

            dr = GetU8ApiBroker(apidata, u8Login, out broker, "load");
            broker.AssignNormalValue("VouchID", vouchid);
            broker.AssignNormalValue("blnAuth", false);
            if (!broker.Invoke())
            {
                //错误处理
                Exception apiEx = broker.GetException();
                if (apiEx != null)
                {
                    if (apiEx is MomSysException)
                    {
                        MomSysException sysEx = apiEx as MomSysException;
                        dr.ResultNum = -1;
                        dr.ResultMsg = "系统异常:" + sysEx.Message;
                    }
                    else if (apiEx is MomBizException)
                    {
                        MomBizException bizEx = apiEx as MomBizException;
                        dr.ResultNum = -1;
                        dr.ResultMsg = "API异常:" + bizEx.Message;
                    }

                    String exReason = broker.GetExceptionString();
                    if (exReason.Length != 0)
                    {
                        dr.ResultNum = -1;
                        dr.ResultMsg = " 异常原因:" + exReason;
                    }
                }
                broker.Release();

                return(dr);
            }
            System.String result = broker.GetReturnValue() as System.String;
            if (result != string.Empty)
            {
                domHead = broker.GetBoParam("domHead");
                domBody = broker.GetBoParam("domBody");
                domHead.NeedFieldsCheck = false;
                domBody.NeedFieldsCheck = false;
            }
            else
            {
                dr.ResultMsg = result;
                dr.ResultNum = -1;
                broker.Release();

                BLL.Common.ErrorMsg("", result);
            }
            broker.Release();

            return(dr);
        }
예제 #49
0
        private List <BusinessObject> GetDesignDataSource()
        {
            List <BusinessObject> BusinessObjectCollection = new List <BusinessObject>();
            BusinessObject        Record1 = new BusinessObject()
            {
                TaskId    = 1,
                TaskName  = "Design",
                StartDate = "02/10/2017",
                EndDate   = "02/14/2017",
                Progress  = 86,
                Duration  = 3,
                Children  = new List <BusinessObject>(),
            };

            BusinessObject Child1 = new BusinessObject()
            {
                TaskId    = 2,
                TaskName  = "Software Specification",
                StartDate = "02/10/2017",
                EndDate   = "02/12/2017",
                Duration  = 3,
                Progress  = 60
            };

            BusinessObject Child2 = new BusinessObject()
            {
                TaskId    = 3,
                TaskName  = "Develop prototype",
                StartDate = "02/10/2017",
                EndDate   = "02/12/2017",
                Duration  = 3,
                Progress  = 100
            };

            BusinessObject Child3 = new BusinessObject()
            {
                TaskId    = 4,
                TaskName  = "Get approval from customer",
                StartDate = "02/13/2017",
                EndDate   = "02/14/2017",
                Duration  = 2,
                Progress  = 100
            };

            BusinessObject Child4 = new BusinessObject()
            {
                TaskId    = 5,
                TaskName  = "Design complete",
                StartDate = "02/14/2017",
                EndDate   = "02/14/2017",
                Duration  = 0,
                Progress  = 0
            };

            Record1.Children.Add(Child1);
            Record1.Children.Add(Child2);
            Record1.Children.Add(Child3);
            Record1.Children.Add(Child4);
            BusinessObjectCollection.Add(Record1);
            return(BusinessObjectCollection);
        }
예제 #50
0
 public abstract void Delete(BusinessObject sender, BusinessChangeEventArgs args);
예제 #51
0
        /// <summary>
        /// Returns the displayable column value for the current related record table. (i.e., Procedures=ProcName)
        /// </summary>
        /// <param name="dataItem"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        protected string GetDisplayColumn(object dataItem, string tableName)
        {
            string fieldName = rc.GetRelatedRecordField(tableName);

            fieldName = !string.IsNullOrEmpty(tableName) && !string.IsNullOrEmpty(fieldName) && BusinessObject.HasField(tableName, fieldName) ? fieldName : string.Empty;
            return(GetDisplayColumn(dataItem, tableName, fieldName));
        }
예제 #52
0
        public void ShowCaseTestAsymmetric()
        {
            Assert.IsTrue(maLo.IsValid()); // as the encryption relies on serializing the BO invalid BOs cannot be encrypted.

            var aliceKeyPair = Sodium.PublicKeyBox.GenerateKeyPair();
            var bobKeyPair   = Sodium.PublicKeyBox.GenerateKeyPair();

            Debug.WriteLine($"Bob: Hey @Alice, this is my public key: {Convert.ToBase64String(bobKeyPair.PublicKey).Substring(10)}...");
            // Bob: Hey @Alice, this is my public key: HsGsYigFqgDouUvUW3uMYpy54DqsAxXxQ=...

            EncryptedObject encryptedBo;

            using (AsymmetricEncrypter aliceEncrypter = new AsymmetricEncrypter(aliceKeyPair))
            {
                encryptedBo = aliceEncrypter.Encrypt(maLo, Convert.ToBase64String(bobKeyPair.PublicKey));
            }
            Debug.WriteLine($"Alice: Hey @Bob: This is my signed and encrypted BusinssObject: ");
            Debug.WriteLine(JsonConvert.SerializeObject(encryptedBo, new StringEnumConverter()));
            //{
            //  "boTyp": "ENCRYPTEDOBJECTPUBLICKEYBOX",
            //  "versionStruktur": 1,
            //  "publicKey": "jpo2D3IK9BgPOLyXPfimfSD3u9VErT3kP5IYDMVY0Bo=",
            //  "encryptionScheme": "SodiumAsymmetricPublicKeyBox",
            //  "nonce": "KdNf7rQlQzOyajX+nMKBROce9odVuJqF",
            //  "cipherText": "VIYM7nZU9yTSj2tT...zWUuGbp4HphTlBlzgK"
            //}
            Debug.WriteLine($"Alice: And by the way, I hope you verified my fingerprint or the key itself.");
            Assert.AreEqual(Convert.ToBase64String(aliceKeyPair.PublicKey), ((EncryptedObjectPublicKeyBox)encryptedBo).PublicKey, "Bob: I did, otherwise this would fail");

            Marktlokation decryptedMaLo;

            using (AsymmetricEncrypter bobsDecrypter = new AsymmetricEncrypter(bobKeyPair.PrivateKey))
            {
                BusinessObject decryptedBo = bobsDecrypter.Decrypt(encryptedBo);    // In case Bob had no idea what alice sent him...
                Assert.IsInstanceOfType(decryptedBo, typeof(Marktlokation));        // ...now he knows.
                decryptedMaLo = bobsDecrypter.Decrypt <Marktlokation>(encryptedBo); // Bob knows at compile time it's a MaLo.
            }
            Assert.AreEqual(maLo, decryptedMaLo);

            var eveKeyPair = Sodium.PublicKeyBox.GenerateKeyPair();
            // Eve entered the chat
            EncryptedObjectPublicKeyBox manipulatedBo;

            using (AsymmetricEncrypter eveEncrypter = new AsymmetricEncrypter(eveKeyPair))
            {
                manipulatedBo = eveEncrypter.Encrypt(maLo, Convert.ToBase64String(bobKeyPair.PublicKey));
            }
            manipulatedBo.PublicKey = Convert.ToBase64String(aliceKeyPair.PublicKey); // Eve: Never will Bob know this message is not from Alice!
            Debug.WriteLine("Eve: Hey @Bob, Alice asked me to give you this BO");

            Assert.AreEqual(Convert.ToBase64String(aliceKeyPair.PublicKey), manipulatedBo.PublicKey, "Bob: Hrm, seems like it's from Alice, indeed...");
            using (AsymmetricEncrypter bobsDecrypter = new AsymmetricEncrypter(bobKeyPair.PrivateKey))
            {
                try
                {
                    bobsDecrypter.Decrypt(manipulatedBo);
                }
                catch (System.Security.Cryptography.CryptographicException ce)
                {
                    Debug.WriteLine($"Bob: @Eve: You tried to fool me! {ce.Message}");
                    // As long as Bob checks that the public key stored in the Encrypted Business Object matches the public key of the expected sender he'll be fine.
                }
            }
        }
예제 #53
0
 public ITransactionLog GetLogger(BusinessObject bo, string tableName)
 {
     return new TransactionLogTable(bo, tableName);
 }
예제 #54
0
파일: SfcOp.cs 프로젝트: fightx/U8
        /// <summary>
        /// 删除单据
        /// </summary>
        /// <param name="bd"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public override Model.DealResult UndoMake(BaseData bd, Model.Synergismlogdt dt)
        {
            Model.DealResult dr      = new Model.DealResult();
            Model.APIData    apidata = bd as Model.APIData;
            BusinessObject   domHead = null;
            BusinessObject   domBody = null;

            string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id");

            if (string.IsNullOrEmpty(vouchid))
            {
                return(dr);
            }

            try
            {
                CancelAudit(apidata, dt);
            }
            catch (Exception ex)
            {
                Log.WriteWinLog("saleop_cancelaudit:" + ex.ToString());
                dr.ResultNum = -1;
                dr.ResultMsg = ex.Message;
                return(dr);
            }
            LoadVouch(apidata, dt, out domHead, out domBody);
            domHead.NeedFieldsCheck = false;
            domBody.NeedFieldsCheck = false;

            U8Login.clsLogin u8Login = new U8Login.clsLogin();
            dr = GetU8Login(apidata, u8Login);
            if (dr.ResultNum < 0)
            {
                return(dr);
            }
            U8ApiBroker broker = null;

            dr = GetU8ApiBroker(apidata, u8Login, out broker, "delete");
            if (dr.ResultNum < 0)
            {
                return(dr);
            }
            broker.SetBoParam("domHead", domHead);
            try
            {
                broker.SetBoParam("dombodyforlog", domBody);
            }
            catch { }
            if (!broker.Invoke())
            {
                Exception apiEx = broker.GetException();
                if (apiEx != null)
                {
                    if (apiEx is MomSysException)
                    {
                        MomSysException sysEx = apiEx as MomSysException;
                        dr.ResultNum = -1;
                        dr.ResultMsg = "系统异常:" + sysEx.Message;
                    }
                    else if (apiEx is MomBizException)
                    {
                        MomBizException bizEx = apiEx as MomBizException;
                        dr.ResultNum = -1;
                        dr.ResultMsg = "API异常:" + bizEx.Message;
                    }
                    String exReason = broker.GetExceptionString();
                    if (exReason.Length != 0)
                    {
                        dr.ResultNum = -1;
                        dr.ResultMsg = " 异常原因:" + exReason;
                    }
                }
                broker.Release();

                return(dr);
            }
            System.String result = broker.GetReturnValue() as System.String;
            broker.Release();
            if (result != null)
            {
                dr.ResultNum = -1;
                dr.ResultMsg = result;
                throw new Exception(result);
            }

            return(dr);
        }
예제 #55
0
        /////<summary>
        ///// Constructs the new transactionlogTable with default table name and logging fields.
        /////</summary>
        /////<param name="busObjToLog"></param>
        //public TransactionLogTable(BusinessObject busObjToLog)
        //    : this(busObjToLog, "transactionLog", "DateTimeUpdated",
        //        "WindowsUser", "LogonUser", "MachineName", "BusinessObjectTypeName", "CRUDAction", "DirtyXML")
        //{

        //}

        ///<summary>
        /// Constructs the new transactionlogTable with default table name and logging fields.
        ///</summary>
        ///<param name="busObjToLog"></param>
        public TransactionLogTable(BusinessObject busObjToLog)
            : this(busObjToLog, "transactionLog")
        {

        }
        public override bool Validate(BusinessObject businessObject)
        {
            int length = GetPropertyValue(businessObject).ToString().Length;

            return(length >= _min && length <= _max);
        }
예제 #57
0
 /// <summary>
 /// Constructs the new transactionlogTable with default table name and logging fields and a specific security controller for getting the currently logged on user.
 /// </summary>
 /// <param name="busObjToLog"></param>
 /// <param name="securityController"></param>
 /// <param name="transactionLogTable"></param>
 public TransactionLogTable(BusinessObject busObjToLog, ISecurityController securityController, string transactionLogTable)
     : this(busObjToLog, transactionLogTable, "DateTimeUpdated",
            "WindowsUser", "LogonUser", "BusinessObjectToString", "MachineName", "BusinessObjectTypeName", "CRUDAction", "DirtyXML")
 {
     _securityController = securityController;
 }
예제 #58
0
 public BOViewModel(BusinessObject model)
 {
     Model = model;
 }
 /// <summary>
 /// Constructor to initialise the generator
 /// </summary>
 /// <param name="bo">The business object whose properties are to
 /// be inserted</param>
 /// <param name="connection">A database connection</param>
 public InsertStatementGenerator(IBusinessObject bo, IDatabaseConnection connection)
 {
     _bo = (BusinessObject) bo;
     _connection = connection;
 }
예제 #60
0
파일: List.ascx.cs 프로젝트: hdgardner/ECF
        /// <summary>
        /// Gets the data source.
        /// </summary>
        /// <param name="totalRecords">The total records.</param>
        /// <returns></returns>
        private DataTable GetDataSource(out int totalRecords)
        {
            DataTable table         = new DataTable();
            int       grandParentId = -1;

            char[] delimiters = new char[] { '.' };

            table.Columns.Add(new DataColumn("ID", typeof(string)));
            table.Columns.Add(new DataColumn("Type", typeof(string)));
            table.Columns.Add(new DataColumn("OutlineNumber", typeof(string)));
            table.Columns.Add(new DataColumn("CheckboxEnabled", typeof(bool)));
            table.Columns.Add(new DataColumn("Name", typeof(string)));
            table.Columns.Add(new DataColumn("Filename", typeof(string)));
            table.Columns.Add(new DataColumn("Size", typeof(string)));
            table.Columns.Add(new DataColumn("Url", typeof(string)));
            table.Columns.Add(new DataColumn("Icon", typeof(string)));
            table.Columns.Add(new DataColumn("Created", typeof(DateTime)));
            table.Columns.Add(new DataColumn("GrandParentId", typeof(string)));

            Mediachase.Ibn.Data.Services.TreeNode[] nodes = TreeManager.GetChildNodes(Folder.GetAssignedMetaClass(), ParentId);
            FolderElement[] elements = FolderElement.List <FolderElement>(FolderElement.GetAssignedMetaClass(), new FilterElement[] { new FilterElement("ParentId", FilterElementType.Equal, ParentId) });

            int nodeIndex = 0;

            foreach (Mediachase.Ibn.Data.Services.TreeNode node in nodes)
            {
                //check to see if the grandParentId has been set yet
                if (grandParentId == -1)
                {
                    //get the ID for the folder above the current folder
                    string[] outlineArray = node.OutlineNumber.ToString().Split(delimiters);
                    if (node.OutlineLevel > 2)
                    {
                        int.TryParse(outlineArray[outlineArray.Length - 3].ToString(), out grandParentId);
                    }
                }

                //if (nodeIndex >= recordToDisplay)
                {
                    DataRow newRow = table.NewRow();
                    newRow["ID"]              = node.ObjectId.ToString();
                    newRow["OutlineNumber"]   = node.OutlineNumber;
                    newRow["Type"]            = "Folder";
                    newRow["CheckboxEnabled"] = true;
                    newRow["Name"]            = node.Title;
                    newRow["Icon"]            = String.Format("~/App_Themes/Default/images/icons/Node.gif");
                    newRow["FileName"]        = node.Title;
                    newRow["Url"]             = String.Empty;
                    newRow["Created"]         = (DateTime)node.InnerObject.Properties["Created"].Value;
                    table.Rows.Add(newRow);
                }
                nodeIndex++;
            }

            //check to see if folder outline level was available in folders and that the parent is not the root folder
            if (grandParentId < 0 && ParentId > 1)
            {
                //the grandparent folder id needs to be retrieved through other means
                BusinessObject _bindObject = MetaObjectActivator.CreateInstance <BusinessObject>("Folder", ParentId);
                if (_bindObject != null)
                {
                    //get the ID for the folder above the current folder
                    string[] outlineArray = _bindObject["OutlineNumber"].ToString().Split(delimiters);
                    if (outlineArray.Length > 1)
                    {
                        int.TryParse(outlineArray[outlineArray.Length - 2].ToString(), out grandParentId);
                    }
                }
            }

            //if this row is below the root level, show an up-level folder link.
            //now that all means have been exhausted, only add the up-level link if there is a valid value
            //for the grandParentId
            if (grandParentId >= 0)
            {
                //add a 'level up' row at the top
                // add additional row at the top. Don't add row if parent node is a Catalog
                DataRow row = table.NewRow();
                row["ID"]              = ParentId;
                row["GrandParentId"]   = grandParentId;
                row["CheckboxEnabled"] = false;
                row["Name"]            = "[..]";
                row["Type"]            = "LevelUp";
                table.Rows.InsertAt(row, 0);
            }


            foreach (FolderElement element in elements)
            {
                //if (nodeIndex >= recordToDisplay)
                {
                    DataRow newRow = table.NewRow();

                    newRow["ID"]              = element.PrimaryKeyId.ToString();
                    newRow["OutlineNumber"]   = String.Empty;
                    newRow["Type"]            = "Node";
                    newRow["CheckboxEnabled"] = true;
                    newRow["Name"]            = element.Name;


                    /*
                     * BlobStorageProvider prov = BlobStorage.Providers[element.BlobStorageProvider];
                     * BlobInfo info = prov.GetInfo(new Guid(element.BlobUid.ToString()));
                     * */

                    newRow["Url"] = String.Format("~{0}", element.GetUrl());

                    /*if (info != null)
                     * {
                     *  newRow["FileName"] = info.FileName;
                     *  newRow["Icon"] = CHelper.GetIcon(info.FileName);
                     *  newRow["Created"] = info.Created;
                     *  newRow["Size"] = CommerceHelper.ByteSizeToStr(info.ContentSize);
                     * }
                     * */
                    //else
                    {
                        newRow["FileName"] = element.Name;
                        newRow["Icon"]     = CHelper.GetIcon(element.Name);
                        newRow["Created"]  = element.Created;
                        newRow["Size"]     = CommerceHelper.ByteSizeToStr((element.ContentSize != null) ? (long)element.ContentSize : 0);
                    }

                    table.Rows.Add(newRow);
                }
                nodeIndex++;
            }

            // TODO: implement paging
            totalRecords = nodes.Length + elements.Length;
            return(table);
        }