Example #1
0
 public int GetFieldCount()
 {
     try
     {
         IReflectClass rClass = DataLayerCommon.ReflectClassForName(m_className);
         if (rClass != null)
         {
             string type1 = rClass.ToString();
             type1 = DataLayerCommon.PrimitiveType(type1);
             char[] arr = CommonValues.charArray;
             type1 = type1.Trim(arr);
             if (!CommonValues.IsPrimitive(type1) && !type1.Contains(BusinessConstants.DB4OBJECTS_SYS))
             {
                 IReflectField[] rFields = DataLayerCommon.GetDeclaredFieldsInHeirarchy(rClass);
                 return(rFields.Length);
             }
         }
         return(0);
     }
     catch (Exception oEx)
     {
         LoggingHelper.HandleException(oEx);
         return(0);
     }
 }
Example #2
0
        /// <summary>
        /// Define all the values that are common across all
        /// given <paramref name="rows"/>. Values that differ
        /// between the given <paramref name="rows"/> will be
        /// set to <c>null</c>.
        /// </summary>
        /// <seealso cref="DefineFields(IRowValues, string)"/>
        public FieldSetter DefineFields([NotNull] IEnumerable <IRowValues> rows,
                                        [CanBeNull] string qualifier = null)
        {
            var commonValues = new CommonValues(rows);

            return(DefineFields(commonValues, qualifier));
        }
Example #3
0
        public override void CalculateAreaAndVolume(Facility udf, CommonValues cm)
        {
            var IsCfgE = udf.Configuration == cfgE;
            var agDta  = udf.AboveGrade;
            var ba     = agDta.BottomArea.Value;
            var oSA    = agDta.OverflowSurfaceArea.Value;
            var oHgt   = agDta.OverflowHgtFt;

            // -------------------------------------
            // -------------------------------------
            cm.SurfaceArea75    = ba / 4m + 0.75m * oSA;
            cm.SurfaceArea100   = oSA;
            cm.MaxSurfaceVolume = 0.5m * oHgt * (ba + oSA);
            // ---------------------------------------------

            if (!IsCfgE)
            {
                return;
            }
            var oESA  = agDta.OverflowESurfaceArea.Value;
            var oEHgt = agDta.OverflowEHgtFt;

            // ---------------------------------------------
            cm.OverflowESurfArea75    = 0.25m * ba + 0.75m * oESA;
            cm.OverflowESurfaceVolume = 0.5m * oEHgt * (ba + oESA);
        }
Example #4
0
        public override void CalculateAreaAndVolume(Facility flat, CommonValues cm)
        {
            var IsCfgE = flat.Configuration == cfgE;
            var agDta  = flat.AboveGrade;
            var ba     = agDta.BottomArea.Value;

            // ScAx100PER / ScAx75PER
            cm.SurfaceArea75 = cm.SurfaceArea100 = ba;

            // ScVx
            if (!agDta.OverflowHeight.HasValue)
            {
                throw new PACInputDataException(
                          "OverflowHeight (height of overflow pipe opening), is required for calculations",
                          "OverflowHeight");
            }
            cm.MaxSurfaceVolume = agDta.OverflowHgtFt * ba;

            if (!IsCfgE)
            {
                return;
            }
            // ScVxfirst/ ScAx75PERfirst [For Configuration E Scenarios]
            cm.OverflowESurfArea75    = ba;
            cm.OverflowESurfaceVolume = agDta.OverflowEHgtFt;
        }
Example #5
0
 public ApiActionResult UpdateCommonValues(CommonValueUpdateModel model)
 {
     try
     {
         CommonValues obj = new CommonValues();
         obj = _dbConfigContext.CommonValues.AsNoTracking().FirstOrDefault(x => x.Id == model.Id);
         if (obj != null)
         {
             obj.ValueDouble = model.ValueDouble;
             obj.ValueGroup  = model.ValueGroup;
             obj.ValueInt    = model.ValueInt;
             obj.ValueString = model.ValueString;
             obj.Text        = model.Text;
             obj.OrderBy     = model.OrderBy;
             var resUpdate = _dbConfigContext.CommonValues.Update(obj);
             int flag      = _dbConfigContext.SaveChanges();
             if (flag != 0)
             {
                 return(ApiActionResult.Success());
             }
             return(ApiActionResult.Failed("Updated failed"));
         }
         return(ApiActionResult.Failed("Can not updated because entity doest not existed!!"));
     }
     catch (Exception ex)
     {
         return(ApiActionResult.Failed(ex.Message));
     }
 }
        public void ProvidedServiceCreate_CreateCommand_ShouldBeOk()
        {
            //arrange
            var createCommand   = ObjectMother.ValidProvidedServiceCommand;
            var providedService = ObjectMother.ValidProvidedServiceTanning;

            _mockMapper.Setup(map => map.Map <ProvidedService>(createCommand))
            .Returns(providedService);

            _mockEmployeeRepository.Setup(emp => emp.GetByIdAsync(It.IsAny <Guid>()))
            .Returns(CommonValues.ReturnTask(new Employee()));

            _mockProvidedServiceRepository.Setup(rep => rep.CreateAsync(providedService))
            .Returns(CommonValues.ReturnTask(providedService))
            .Callback((ProvidedService item) =>
            {
                item.Id = Guid.NewGuid();
                item.Version++;
                item.CreatedAt = DateTime.Now;
            });

            //action
            var createdItem = _providedServiceCreateHandler.Handle(createCommand, CommonValues.CancellationTokenSource.Token).Result;

            //verify
            createdItem.IsSuccess.Should().BeTrue();
            createdItem.IsFailure.Should().BeFalse();
            createdItem.Success.Should().NotBe(Guid.Empty);
            providedService.Employees.Should().NotBeNullOrEmpty();
            providedService.Employees.Count.Should().Be(createCommand.EmployeesID.Count);
        }
Example #7
0
        public AuxiliaryStatesTensors ComputeTensorsAt(CartesianPoint globalIntegrationPoint,
                                                       TipCoordinateSystem tipCoordinateSystem)
        {
            // Common calculations
            PolarPoint2D polarCoordinates =
                tipCoordinateSystem.TransformPointGlobalCartesianToLocalPolar(globalIntegrationPoint);
            var commonValues = new CommonValues(polarCoordinates.R, polarCoordinates.Theta);

            // Displacement field derivatives
            Matrix2by2   displacementGradientMode1, displacementGradientMode2;
            TipJacobians polarJacobians = tipCoordinateSystem.CalculateJacobiansAt(polarCoordinates);

            ComputeDisplacementDerivatives(polarJacobians, commonValues,
                                           out displacementGradientMode1, out displacementGradientMode2);

            // Strains
            Tensor2D strainTensorMode1 = ComputeStrainTensor(displacementGradientMode1);
            Tensor2D strainTensorMode2 = ComputeStrainTensor(displacementGradientMode2);

            // Stresses
            Tensor2D stressTensorMode1, stressTensorMode2;

            ComputeStressTensors(commonValues, out stressTensorMode1, out stressTensorMode2);

            return(new AuxiliaryStatesTensors(displacementGradientMode1, displacementGradientMode2,
                                              strainTensorMode1, strainTensorMode2, stressTensorMode1, stressTensorMode2));
        }
Example #8
0
        public override void CalculateAreaAndVolume(Facility amoeba, CommonValues cm)
        {
            var IsCfgE = amoeba.Configuration == cfgE;
            var agDta  = amoeba.AboveGrade;
            var ba     = agDta.BottomArea.GetValueOrDefault(0m);
            var bp     = agDta.BottomPerimeter.GetValueOrDefault(0m);
            var ss     = agDta.SideSlope.GetValueOrDefault(0m);
            var oHgt   = agDta.OverflowHgtFt;
            // --------------------------------------------------
            // --------------------------------------------------
            var refFac = bp * ss * oHgt;

            cm.SurfaceArea100   = ba + refFac;
            cm.SurfaceArea75    = ba + 0.75m * refFac;
            cm.MaxSurfaceVolume = (refFac / 2m + ba) * oHgt;
            if (!IsCfgE)
            {
                return;
            }
            // -------------------------------------
            var oEHgt   = agDta.OverflowEHgtFt;
            var refFacE = bp * ss * oEHgt;

            // -------------------------------------
            cm.OverflowESurfArea75    = ba + 0.75m * refFacE;
            cm.OverflowESurfaceVolume = refFacE / 2m + ba * oEHgt;
        }
Example #9
0
 private static void LoadEntity(DataRow dr, CommonValues cv)
 {
     cv.Sqc         = Convert.ToInt32(dr["sqc"]);
     cv.Key_Str     = dr["key_Str"] != DBNull.Value ? dr["key_Str"].ToString() : String.Empty;
     cv.Value_Str   = dr["value_Str"] != DBNull.Value ? dr["value_Str"].ToString() : String.Empty;
     cv.Create_time = dr["create_time"] != DBNull.Value ? Convert.ToDateTime(dr["Create_time"]) : DateTime.MinValue;
     cv.Update_time = dr["update_time"] != DBNull.Value ? Convert.ToDateTime(dr["update_time"]) : DateTime.MinValue;
 }
Example #10
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                CarServiceVM.ServiceHeader.DateAdded       = DateTime.Now;
                CarServiceVM.ServiceHeader.NextServiceDate = DateTime.Now.AddDays(90);

                CommonValues cv2 = _db.CommonValues.Find(1);

                CarServiceVM.ServiceShoppingCart = _db.ServiceShoppingCart.Include(c => c.ServiceType).Where(c => c.CarId == CarServiceVM.Car.Id).ToList();
                foreach (var item in CarServiceVM.ServiceShoppingCart)
                {
                    CarServiceVM.ServiceHeader.TotalPrice += item.ServiceType.Price * item.Quantity;
                    CarServiceVM.ServiceHeader.TotalPrice  = Math.Round(CarServiceVM.ServiceHeader.TotalPrice, 2);
                    CarServiceVM.ServiceHeader.Tax         = CarServiceVM.ServiceHeader.TotalPrice * cv2.iva;
                    CarServiceVM.ServiceHeader.Tax         = Math.Round(CarServiceVM.ServiceHeader.Tax, 2);
                    CarServiceVM.ServiceHeader.EnvCharge   = cv2.envCharge;
                    CarServiceVM.ServiceHeader.FullPrice   = CarServiceVM.ServiceHeader.Tax + CarServiceVM.ServiceHeader.TotalPrice + CarServiceVM.ServiceHeader.EnvCharge;
                    CarServiceVM.ServiceHeader.FullPrice   = Math.Round(CarServiceVM.ServiceHeader.FullPrice, 2);
                }
                CarServiceVM.ServiceHeader.CarId = CarServiceVM.Car.Id;

                _db.ServiceHeader.Add(CarServiceVM.ServiceHeader);
                await _db.SaveChangesAsync();

                foreach (var detail in CarServiceVM.ServiceShoppingCart)
                {
                    Console.WriteLine(detail.ServiceType.Price);

                    ServiceDetails serviceDetails = new ServiceDetails
                    {
                        ServiceHeaderId = CarServiceVM.ServiceHeader.Id,
                        ServiceName     = detail.ServiceType.Name,
                        ServicePrice    = detail.ServiceType.Price,
                        ServiceTypeId   = detail.ServiceTypeId,
                        Quantity        = detail.Quantity
                    };
                    _db.ServiceDetails.Add(serviceDetails);
                }

                _db.ServiceShoppingCart.RemoveRange(CarServiceVM.ServiceShoppingCart);

                //ACTUALIZACION DE MILLAS
                CarServiceVM.Car.Miles = CarServiceVM.ServiceHeader.Miles;
                _db.Car.Attach(CarServiceVM.Car);
                _db.Entry(CarServiceVM.Car).Property(x => x.Miles).IsModified = true;

                await _db.SaveChangesAsync();

                return(RedirectToPage("../Cars/Index", new { userId = CarServiceVM.Car.UserId }));
            }

            return(RedirectToPage("Create", new { carId = CarServiceVM.Car.Id }));
        }
Example #11
0
 void OnTriggerStay(Collider collider)
 {
     if (collider.tag == CommonValues.tagTriggers && onGround)
     {
         if (!rewarded)
         {
             CommonValues.moneyReward(this.gameObject.tag, CommonValues.REWARD);
             rewarded = true;
         }
     }
 }
Example #12
0
        public IActionResult OnPost(string iva, string envCharge)
        {
            CommonValues cv = new CommonValues {
                Id        = 1,
                iva       = Double.Parse(iva),
                envCharge = Double.Parse(envCharge)
            };

            _db.CommonValues.Update(cv);
            _db.SaveChanges();

            return(RedirectToPage("Index"));
        }
Example #13
0
        private void ComputeDisplacementDerivatives(TipJacobians polarJacobians, CommonValues val,
                                                    out Matrix2by2 displacementGradientMode1, out Matrix2by2 displacementGradientMode2)
        {
            // Temporary values and derivatives of the differentiated quantities. See documentation for their derivation.
            double E   = material.HomogeneousYoungModulus;
            double v   = material.HomogeneousPoissonRatio;
            double vEq = material.HomogeneousEquivalentPoissonRatio;
            double k   = (3.0 - vEq) / (1.0 + vEq);
            double a   = (1.0 + v) / (E * Math.Sqrt(2.0 * Math.PI));
            double b   = val.sqrtR;
            double b_r = 0.5 / val.sqrtR;

            // Mode 1
            {
                // Temporary values that differ between the 2 modes
                double c1       = val.cosThetaOver2 * (k - val.cosTheta);
                double c2       = val.sinThetaOver2 * (k - val.cosTheta);
                double c1_theta = -0.5 * c2 + val.cosThetaOver2 * val.sinTheta;
                double c2_theta = 0.5 * c1 + val.sinThetaOver2 * val.sinTheta;

                // The vector field derivatives w.r.t. to the local polar coordinates.
                // The vector components refer to the local cartesian system though.
                var polarGradient = Matrix2by2.CreateFromArray(
                    new double[, ] {
                    { a *b_r *c1, a *b *c1_theta }, { a *b_r *c2, a *b *c2_theta }
                });
                // The vector field derivatives w.r.t. to the local cartesian coordinates.
                displacementGradientMode1 =
                    polarJacobians.TransformVectorFieldDerivativesLocalPolarToLocalCartesian(polarGradient);
            }

            // Mode 2
            {
                double paren1   = 2.0 + k + val.cosTheta;
                double paren2   = 2.0 - k - val.cosTheta;
                double c1       = val.sinThetaOver2 * paren1;
                double c2       = val.cosThetaOver2 * paren2;
                double c1_theta = 0.5 * val.cosThetaOver2 * paren1 - val.sinThetaOver2 * val.sinTheta;
                double c2_theta = -0.5 * val.sinThetaOver2 * paren2 + val.cosThetaOver2 * val.sinTheta;

                // The vector field derivatives w.r.t. to the local polar coordinates.
                // The vector components refer to the local cartesian system though.
                var polarGradient = Matrix2by2.CreateFromArray(
                    new double[, ] {
                    { a *b_r *c1, a *b *c1_theta }, { a *b_r *c2, a *b *c2_theta }
                });
                // The vector field derivatives w.r.t. to the local cartesian coordinates.
                displacementGradientMode2 =
                    polarJacobians.TransformVectorFieldDerivativesLocalPolarToLocalCartesian(polarGradient);
            }
        }
Example #14
0
        private static void ComputeStressTensors(CommonValues val,
                                                 out Tensor2D stressTensorMode1, out Tensor2D stressTensorMode2)
        {
            double coeff = 1.0 / (Math.Sqrt(2.0 * Math.PI) * val.sqrtR);

            double sxxMode1 = coeff * val.cosThetaOver2 * (1.0 - val.sinThetaOver2 * val.sin3ThetaOver2);
            double syyMode1 = coeff * val.cosThetaOver2 * (1.0 + val.sinThetaOver2 * val.sin3ThetaOver2);
            double sxyMode1 = coeff * val.sinThetaOver2 * val.cosThetaOver2 * val.cos3ThetaOver2;

            double sxxMode2 = -coeff * val.sinThetaOver2 * (2.0 + val.cosThetaOver2 * val.cos3ThetaOver2);
            double syyMode2 = sxyMode1;
            double sxyMode2 = sxxMode1;

            stressTensorMode1 = new Tensor2D(sxxMode1, syyMode1, sxyMode1);
            stressTensorMode2 = new Tensor2D(sxxMode2, syyMode2, sxyMode2);
        }
Example #15
0
        public static void decodeResponseAndImport(string ResponseStr)
        {
            Newtonsoft.Json.Linq.JObject jo = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(ResponseStr);
            if (jo["access_token"] is null)
            {
                throw new Exception("获取AccessToken失败,微信服务器返回:\r\n" + ResponseStr);
            }
            var access_tokenStr = jo["access_token"].ToString();
            var expires_in      = Convert.ToDouble(jo["expires_in"]);

            Model.CommonValues cv = new CommonValues();
            cv.Key_Str     = "AccessToken";
            cv.Value_Str   = access_tokenStr;
            cv.Update_time = DateTime.Now;
            DAL.CommonValuesDAL.UpdateToken(cv);
        }
Example #16
0
 public static bool CheckForDatetimeOrString(object expandedObj)
 {
     try
     {
         IReflectClass refClass = ReflectClassFor(expandedObj);// objectContainer.Ext().Reflector().ForObject(expandedObj);
         if (refClass != null)
         {
             string type = PrimitiveType(refClass.GetName());
             return(CommonValues.IsDateTimeOrString(type));
         }
         return(false);
     }
     catch (Exception oEx)
     {
         LoggingHelper.HandleException(oEx);
         return(false);
     }
 }
Example #17
0
        public async Task <IActionResult> OnGet(int carId)
        {
            CarServiceVM = new CarServiceViewModel
            {
                Car           = await _db.Car.Include(c => c.ApplicationUser).FirstOrDefaultAsync(c => c.Id == carId),
                ServiceHeader = new Models.ServiceHeader()
            };

            cv = _db.CommonValues.Find(1);

            List <String> lstServiceTypeInShoppingCart = _db.ServiceShoppingCart
                                                         .Include(c => c.ServiceType)
                                                         .Where(c => c.CarId == carId)
                                                         .Select(c => c.ServiceType.Name)
                                                         .ToList();

            IQueryable <ServiceType> lstService = from s in _db.ServiceType
                                                  where !(lstServiceTypeInShoppingCart.Contains(s.Name))
                                                  select s;

            CarServiceVM.ServiceTypesList = lstService.ToList();

            CarServiceVM.ServiceShoppingCart = _db.ServiceShoppingCart
                                               .Include(c => c.ServiceType)
                                               .Where(c => c.CarId == carId)
                                               .ToList();
            CarServiceVM.ServiceHeader.TotalPrice = 0;
            CarServiceVM.ServiceHeader.Tax        = 0;


            foreach (var item in CarServiceVM.ServiceShoppingCart)
            {
                CarServiceVM.ServiceHeader.TotalPrice += item.ServiceType.Price * item.Quantity;
                CarServiceVM.ServiceHeader.TotalPrice  = Math.Round(CarServiceVM.ServiceHeader.TotalPrice, 2);
                CarServiceVM.ServiceHeader.Tax         = CarServiceVM.ServiceHeader.TotalPrice * cv.iva;
                CarServiceVM.ServiceHeader.Tax         = Math.Round(CarServiceVM.ServiceHeader.Tax, 2);
                CarServiceVM.ServiceHeader.EnvCharge   = cv.envCharge;
                CarServiceVM.ServiceHeader.FullPrice   = CarServiceVM.ServiceHeader.Tax + CarServiceVM.ServiceHeader.TotalPrice + CarServiceVM.ServiceHeader.EnvCharge;
                CarServiceVM.ServiceHeader.FullPrice   = Math.Round(CarServiceVM.ServiceHeader.FullPrice, 2);
            }

            return(Page());
        }
Example #18
0
    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.GetComponent <Rigidbody>() != null)
        {
            velocityImpact = +col.gameObject.GetComponent <Rigidbody>().velocity.magnitude;
        }

        if (velocityImpact > MaxImpactForce)
        {
            Instantiate(breakBreaked, transform.position, transform.rotation);
            CommonValues.moneyReward(this.gameObject.tag, CommonValues.PUNISH);
            CommonValues.MessageManager.DrawMsgBox("Você estragou esse material. Manusei com cuidado, os materiais devem ser guardados em segurança.", CommonValues.ERROR);
            Destroy(this.gameObject);
        }

        if (GetComponent <ScrTransportableBehaviour>().wasCaught == true)
        {
            onGround = true;
        }
    }
Example #19
0
        public ApiActionResult CreateNewCommonValues(CommonValueCreateModel model)
        {
            try
            {
                CommonValues obj = new CommonValues();
                obj          = _mapper.Map <CommonValueCreateModel, CommonValues>(model);
                obj.UniqueId = UniqueIDHelper.GenerateRandomString(12);
                _dbConfigContext.CommonValues.Add(obj);
                var flag = _dbConfigContext.SaveChanges();

                if (flag != 0)
                {
                    return(ApiActionResult.Success());
                }
                return(ApiActionResult.Failed("Created Failed"));
            }
            catch (Exception ex)
            {
                return(ApiActionResult.Failed(ex.Message));
            }
        }
Example #20
0
        public void SchedulingCreateTests_CreateHandlerCommand_ShouldBeOk()
        {
            //arrange
            var createCommand = ObjectMother.ValidSchedulingCreateCommand;
            var validToCreate = ObjectMother.ValidSchedulingToCreate;


            _mockMapper.Setup(map => map.Map <Scheduling>(createCommand))
            .Returns(validToCreate);

            _mockEmployeeRepository.Setup(emp => emp.GetByIdAsync(createCommand.EmployeeId))
            .Returns(CommonValues.ReturnTask(ObjectMother.ValidEmployee));

            _mockProvidedServiceRepository.Setup(serv => serv.GetByIdAsync(CommonValues.ProvidedServicNail))
            .Returns(CommonValues.ReturnTask(ObjectMother.ValidProvidedServicNail));

            _mockProvidedServiceRepository.Setup(serv => serv.GetByIdAsync(CommonValues.ProvidedServicHairColoring))
            .Returns(CommonValues.ReturnTask(ObjectMother.ValidProvidedServicHairColoring));

            _mockProvidedServiceRepository.Setup(serv => serv.GetByIdAsync(CommonValues.ProvidedServicTanning))
            .Returns(CommonValues.ReturnTask(ObjectMother.ValidProvidedServiceTanning));

            _mockSchedulingRepository.Setup(sch => sch.CreateAsync(validToCreate))
            .Callback((Scheduling item) =>
            {
                item.CreatedAt = DateTime.Now;
                item.Id        = Guid.NewGuid();
            })
            .Returns(CommonValues.ReturnTask(validToCreate));

            //action
            var idCreated = _schedulingCreateHandler.Handle(createCommand, CommonValues.CancellationTokenSource.Token).Result;


            //verify
            idCreated.IsSuccess.Should().BeTrue();
            idCreated.Success.Should().NotBe(Guid.Empty);
        }
Example #21
0
 // Start is called before the first frame update
 void Start()
 {
     commonValues = transform.GetComponent <CommonValues>();
 }
Example #22
0
        //-------------------------------------------------------------------------

        // Returns the common value's value if the value is for a common value,
        // otherwise just returns the given value.
        //
        // simpleCompare == true : just compares entire strings
        // simpleCompare == false : checks within strings to find common value keys

        public string GetCommonValue(string value, bool simpleCompare)
        {
            // Check local settings first.
            IEnumerable <KeyValuePair <string, string> > results =
                CommonValues.Where(
                    x => x.Key.ToUpper() == value.ToUpper());

            if (results.Count() > 0)
            {
                return(results.First().Value);
            }

            // Check the globals.
            results =
                Program.g_projectManager.CommonValues.Where(
                    x => x.Key.ToUpper() == value.ToUpper());

            if (results.Count() > 0)
            {
                return(results.First().Value);
            }

            // The following is legacy, but is probably partially used when
            // 'simple compares' aren't desired.

            // try this project
            foreach (string commonKey in CommonValues.Keys)
            {
                if (simpleCompare)
                {
                    if (commonKey.ToUpper() == value.ToUpper())
                    {
                        CommonValues.TryGetValue(commonKey, out value);
                        return(value);
                    }
                }
                else
                {
                    string valueUpper = value.ToUpper();

                    if (valueUpper.Contains(commonKey.ToUpper()))
                    {
                        string commonKeyValue;
                        CommonValues.TryGetValue(commonKey, out commonKeyValue);

                        int index = valueUpper.IndexOf(commonKey.ToUpper());

                        value = value.Remove(index, commonKey.Length);
                        value = value.Insert(index, commonKeyValue);

                        return(value);
                    }
                }
            }

            // try the global store
            foreach (string commonKey in Program.g_projectManager.CommonValues.Keys)
            {
                if (simpleCompare)
                {
                    if (commonKey.ToUpper() == value.ToUpper())
                    {
                        Program.g_projectManager.CommonValues.TryGetValue(commonKey, out value);
                        return(value);
                    }
                }
                else
                {
                    string valueUpper = value.ToUpper();

                    if (valueUpper.Contains(commonKey.ToUpper()))
                    {
                        string commonKeyValue;
                        Program.g_projectManager.CommonValues.TryGetValue(commonKey, out commonKeyValue);

                        int index = valueUpper.IndexOf(commonKey.ToUpper());

                        value = value.Remove(index, commonKey.Length);
                        value = value.Insert(index, commonKeyValue);

                        return(value);
                    }
                }
            }

            return(value);
        }
Example #23
0
		void CreateExternesProgrammGenerationEntry (DataRow [] ShowAbleFiles, System.Web.UI.ControlCollection ParentContainer)
			{
			foreach (DataRow ShowAbleFile in ShowAbleFiles)
				{
				String SubPathAndName = ShowAbleFile ["SubPathAndName"].ToString ();
				String ArchiveID = ShowAbleFile ["ArchiveID"].ToString ();
				String ArchivePhysicalPath = Dh.GetArchivePhysicalPath (ArchiveID);
				String AutoFileName = Path.Combine (ArchivePhysicalPath, SubPathAndName);
				CVM.CommonValues m_CVM = new CommonValues (true);
				m_CVM.LoadAndProcessAutoFile (AutoFileName);
				WPMediaStandbildPlayingData m_StandBildPlayingData
					= m_CVM.DeSerializedDesriptionObject as CVM.WPMediaStandbildPlayingData;
				if (m_StandBildPlayingData == null)
					continue;
				String PlayingOrder = m_StandBildPlayingData.ActiveSortField ();

				int NumberOfEntries = m_StandBildPlayingData.NamesOfActiveDescriptions.Count;
				String NumberOfEntriesString = Convert.ToString (NumberOfEntries);
				String NumberOfPlayingEntries = Convert.ToString (m_StandBildPlayingData.NamesOfActiveDescriptions.Count);
				TableRow MaterialRow = new TableRow ();
				MaterialRow.CssClass = "CSS_MaterialRow";
				ParentContainer.Add (MaterialRow);
				TableCell MaterialFormatCell = new TableCell ();
				MaterialFormatCell.CssClass = "CSS_MaterialFormatCell";
				MaterialRow.Controls.Add (MaterialFormatCell);
				MaterialFormatCell.Text = "Karteien";

				TableCell MaterialNameCell = new TableCell ();
				MaterialNameCell.CssClass = "CSS_StandBildMaterialNameCell";
				MaterialRow.Controls.Add (MaterialNameCell);

				bool FirstTime = true;
				StringBuilder TextEntries = new StringBuilder();
//TODO				String HREFToNachrichtenagentur = "http://nachrichten.citynews.at/StandBild/ShowTableSelection?TableName="
				String HREFToNachrichtenagentur = "http://nachrichten.citynews.at/Public/ShowTableSelection?TableName="
					+ m_StandBildPlayingData.TableName + "&TableID="
					+ m_StandBildPlayingData.TableDefinitionTable.Rows [0] ["ID"].ToString ()
					+ "&AuftragGeberSelection=No&SenderSelection=All&DisplayName=All";
				TextEntries.AppendLine ("<a href=\"" + HREFToNachrichtenagentur + "\" target=\"_blank\"><strong>");
				TextEntries.AppendLine ("Um die für \"" + m_StandBildPlayingData.TableName + "\" verwendeten<br>");
				TextEntries.AppendLine ("Standbild Einträge und deren zeitliche Verteilung<br>");
				TextEntries.AppendLine ("zu sehen, verwenden sie bitte diesen Link,<br>");
				TextEntries.AppendLine ("der Sie zur WPMedia Nachrichtenagentur führt.<br>");
				TextEntries.AppendLine ("Dort können Sie auch weitere Informationen abrufen.<br>");
				TextEntries.AppendLine ("Mit der \"Zurück\" Taste Ihres Browsers<br>");
				TextEntries.AppendLine ("kommen Sie dann wieder hierher<br>");
				TextEntries.AppendLine ("</strong></a><br>");

				MaterialNameCell.Text = TextEntries.ToString ();

				TableCell MaterialQualityCell = new TableCell ();
				MaterialQualityCell.CssClass = "CSS_MaterialQualityCell";
				MaterialRow.Controls.Add (MaterialQualityCell);
				MaterialQualityCell.Text = NumberOfEntriesString + " Einträge";

				TableCell MaterialSizeCell = new TableCell ();
				MaterialSizeCell.CssClass = "CSS_MaterialSizeCell";
				MaterialRow.Controls.Add (MaterialSizeCell);
				MaterialSizeCell.Text = ShowAbleFiles [0] ["FileSizeInkB"].ToString () + "kB";

				}

			}
        /// <summary>
        /// Initialize Editing Control, control type is AIDataGridViewDateTimePickerEditingControl.
        /// </summary>
        /// <param name="rowIndex"></param>
        /// <param name="initialFormattedValue"></param>
        /// <param name="dataGridViewCellStyle"></param>
        public override void InitializeEditingControl(int rowIndex, object
                                                      initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            // Set the value of the editing control to the current cell value.
            try
            {
                base.InitializeEditingControl(rowIndex,
                                              initialFormattedValue,
                                              dataGridViewCellStyle);

                string typeOfValue = string.Empty;
                IType  type        = this.Tag as IType;
                if (type == null || type.IsNullable)
                {
                    type =
                        this.DataGridView.Rows[rowIndex].Cells[Constants.QUERY_GRID_FIELDTYPE_DISPLAY_HIDDEN].Value as
                        IType;
                }
                if (type.IsNullable)
                {
                    typeOfValue = CommonValues.GetSimpleNameForNullable(type.FullName);
                }
                else
                {
                    typeOfValue = type.DisplayName;
                }
                // }

                if (typeOfValue == typeof(System.DateTime).ToString() ||
                    (type != null && type.IsSameAs(typeof(DateTime))))
                {
                    dbDataGridViewDateTimePickerEditingControl ctl =
                        DataGridView.EditingControl as dbDataGridViewDateTimePickerEditingControl;

                    if (this.Value != null && this.Value != this.OwningColumn.DefaultCellStyle)
                    {
                        try
                        {
                            DateTimeFormatInfo dateTimeFormatterProvider = DateTimeFormatInfo.CurrentInfo.Clone() as DateTimeFormatInfo;
                            dateTimeFormatterProvider.ShortDatePattern = "MM/dd/yyyy hh:mm:ss tt";
                            DateTime dateTime = DateTime.Parse(Value.ToString(), dateTimeFormatterProvider);
                            ctl.Value = dateTime;
                        }
                        catch (Exception ex)
                        {
                            ex.ToString();
                            ctl.Value = System.DateTime.Now;
                        }
                    }
                }
                else if (typeOfValue == typeof(System.Boolean).ToString() ||
                         (type != null && type.IsSameAs(typeof(Boolean))))
                {
                    //intializing editing control (DataGridViewComboBoxEditingControl)
                    DataGridViewComboBoxEditingControl ctl =
                        this.DataGridView.EditingControl as DataGridViewComboBoxEditingControl;

                    //setting combox style
                    ctl.DropDownStyle = ComboBoxStyle.DropDownList;
                    ctl.FlatStyle     = FlatStyle.Popup;
                    FillBoolColumnValue(ctl);

                    if (this.Value != null && this.Value != this.OwningColumn.DefaultCellStyle)
                    {
                        try
                        {
                            ctl.EditingControlFormattedValue = this.Value.ToString();
                        }
                        catch (Exception ex)
                        {
                            ex.ToString();
                            ctl.SelectedItem = ctl.Items[0].ToString();
                        }
                    }
                    ctl.Width = this.OwningColumn.Width;
                }
            }
            catch (Exception oEx)
            {
                string str = oEx.Message;
            }
        }
Example #25
0
 public IActionResult OnGet()
 {
     cv = //null;
          _db.CommonValues.Find(1);
     return(Page());
 }