예제 #1
0
        public static bool IsPriorityEqualOrHigher(this OperationTypeEnum current, OperationTypeEnum other)
        {
            if (current == other)
            {
                return(true);
            }
            else
            {
                switch (current)
                {
                case OperationTypeEnum.Addition:
                    return(other == OperationTypeEnum.Subtraction);

                case OperationTypeEnum.Subtraction:
                    return(other == OperationTypeEnum.Addition);

                case OperationTypeEnum.Multiplication:
                    return(other == OperationTypeEnum.Division || other == OperationTypeEnum.Addition || other == OperationTypeEnum.Subtraction);

                case OperationTypeEnum.Division:
                    return(other == OperationTypeEnum.Multiplication || other == OperationTypeEnum.Addition || other == OperationTypeEnum.Subtraction);

                case OperationTypeEnum.Exponentiation:
                    return(true);

                default:
                    return(false);
                }
            }
        }
예제 #2
0
 public DeviceOperationType(byte machineType, EnumerationMember machineMember, OperationTypeEnum operationType, bool hasMachineConfiguration)
 {
     ClientNAMEMachineType    = machineType;
     MachineEnumerationMember = machineMember;
     OperationType            = operationType;
     HasMachineConfiguration  = hasMachineConfiguration; //Defines whether a device should be configured as a Machine or an Implement in the ADAPT model
 }
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            ServerCommandProxy serverProxy = null;
            OperationTypeEnum  operation   = OperationTypeEnum.Update;

            txtblockOutput.Inlines.Clear();

            try
            {
                ValidationResult result = ValidateInput(operation);

                if (result.IsValid)
                {
                    string ppcHostname = txtboxPpcServer.Text;
                    string ppcAdminPw  = pwdboxPpcAdminPw.Password;

                    serverProxy = new ServerCommandProxy(ppcHostname, 9191, ppcAdminPw);

                    if (PaperCutProxyWrapper.IsConnectionEstablished(serverProxy))
                    {
                        txtblockOutput.Inlines.Add(Constants.PaperCut.Messages.PaperCutConnectionEstablished);

                        int totalUsers = serverProxy.GetTotalUsers();

                        Console.WriteLine(string.Format(Constants.PaperCut.Messages.NumberOfUsersRetrievedFromPaperCut, totalUsers));
                        Console.WriteLine(Constants.ConsoleSpacing.HashesWithNewLine);

                        PaperCutHelper paperCutHelper = new PaperCutHelper(serverProxy);

                        if (paperCutHelper != null)
                        {
                            int  targetIdField     = cmboxTargetIDField.SelectedIndex;
                            int  numberOfChars     = int.Parse(txtboxIDLength.Text.ToString());
                            bool updateOnlyIfBlank = chckboxUpdateIfBlank.IsChecked.Value;

                            bool mustTargetSpecificUsername = chckboxTargetSpecificUser.IsChecked.Value;

                            if (mustTargetSpecificUsername)
                            {
                                string specificUsername = txtboxTargetSpecificUser.Text;

                                paperCutHelper.UpdateSingleCardNumber(updateOnlyIfBlank, targetIdField, specificUsername, numberOfChars);
                            }
                            else
                            {
                                paperCutHelper.UpdateAllCardNumbers(updateOnlyIfBlank, targetIdField, numberOfChars);
                            }
                        }
                    }
                    else
                    {
                        txtblockOutput.Inlines.Add(Constants.PaperCut.Messages.PaperCutConnectionNotEstablished);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #4
0
        public void Execute(OperationTypeEnum op, OperationStage stage, Entity entity, Schema.Domain.Entity entityMetadata, List <Schema.Domain.Attribute> attributeMetadatas)
        {
            var plugins = _entityPluginFinder.QueryByEntityId(entityMetadata.EntityId, Enum.GetName(typeof(OperationTypeEnum), op));

            if (plugins.NotEmpty())
            {
                foreach (var pg in plugins)
                {
                    if (pg.StateCode == RecordState.Disabled)
                    {
                        continue;
                    }
                    var pinstance = GetInstance(pg);
                    if (pinstance != null)
                    {
                        pinstance.Execute(new PluginExecutionContext()
                        {
                            MessageName = op
                            ,
                            Stage = stage
                            ,
                            Target = entity
                            ,
                            User = _currentUser
                            ,
                            EntityMetadata = entityMetadata
                            ,
                            AttributeMetadatas = attributeMetadatas
                        });
                    }
                }
            }
        }
예제 #5
0
        public CustomerSelector_ViewModel(OperationTypeEnum ct)
        {
            if (!this.IsInDesignMode)
            {
                isEditable            = false;
                isReadonly            = false;
                commentSaveVisibility = Visibility.Collapsed;

                customerMode = ct;

                switch (ct)
                {
                case OperationTypeEnum.Rental:
                    customerNameLabel = "Kölcsönző neve:";
                    break;

                case OperationTypeEnum.Service:
                    customerNameLabel = "Ügyfél neve:";
                    break;

                default:
                    break;
                }
            }
        }
예제 #6
0
 //https://gunnarpeipman.com/data/constructors-with-arguments-ef-core/
 //Constructor for EF core: https://docs.microsoft.com/en-us/ef/core/modeling/constructors
 //The parameter types and names must match property types and names
 private Operation(double x, double y, OperationTypeEnum operationType)
 {
     X             = x;
     Y             = y;
     OperationType = operationType;
     Result        = CalculateResult();
 }
예제 #7
0
        /// <summary>
        /// attached and deleted this generic type entity to current dbcontext
        /// </summary>
        /// <param name="ctx">dbcontext instance</param>
        /// <param name="obj">IEntitySet instance</param>
        /// <param name="operationType">操作类型, 这里只接受是否逻辑删除</param>
        public static void Delete(this DbContext ctx, object obj, OperationTypeEnum operationType = OperationTypeEnum.Delete)
        {
            try
            {
                var t = obj as IEntitySet;
                if (t.IsNullOrEmpty())
                {
                    throw new ArgumentNullException(nameof(obj));
                }

                if (operationType == OperationTypeEnum.LogicDelete)
                {
                    (t as EntitySetWithCreate).DataStatus = DataStatusEnum.Deleted;
                    ctx.Save(t);
                }
                else
                {
                    ctx.Remove(obj);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
        }
예제 #8
0
        /// <summary>
        /// attached and deleted this generic type entity to current dbcontext
        /// </summary>
        /// <typeparam name="T">IEntitySet</typeparam>
        /// <param name="ctx">dbcontext instance</param>
        /// <param name="id">IEntitySet instance id</param>
        /// <param name="operationType">操作类型, 这里只接受是否逻辑删除</param>
        public static void Delete <T>(this DbContext ctx, object id, OperationTypeEnum operationType = OperationTypeEnum.Delete) where T : class, IEntitySet
        {
            try
            {
                if (id == null)
                {
                    throw new ArgumentNullException(typeof(T).FullName);
                }

                T t = ctx.Set <T>().Find(id);
                if (t == null)
                {
                    throw new ArgumentException(typeof(T).FullName + $" not found with Id '{id}'");
                }

                if (operationType == OperationTypeEnum.LogicDelete)
                {
                    (t as EntitySetWithCreate).DataStatus = DataStatusEnum.Deleted;
                    ctx.Set <T>().Update(t);
                }
                else
                {
                    ctx.Set <T>().Remove(t);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
        }
예제 #9
0
        /// <summary>
        /// 写入作业日志
        /// </summary>
        /// <param name="type"></param>
        /// <param name="ColumnName"></param>
        /// <param name="Remark"></param>
        public void LogInsert(OperationTypeEnum type, string ColumnName, string Remark)
        {
            ModSysOperateLog t = new ModSysOperateLog();

            if (type == OperationTypeEnum.访问)
            {
                t.LogType = "0";
            }
            if (type == OperationTypeEnum.操作)
            {
                t.LogType = "1";
            }
            if (type == OperationTypeEnum.异常)
            {
                t.LogType = "2";
            }
            t.Id         = Guid.NewGuid().ToString();
            t.UserName   = CurrentMaster.UserName;
            t.LinkUrl    = Request.Url.ToString();
            t.Remark     = Remark; //备注
            t.Status     = 1;      //状态
            t.CreaterId  = CurrentMaster.Id;
            t.IPAddress  = IPAddressAll();
            t.ColumnName = ColumnName;
            t.CreateTime = DateTime.Now;
            ThreadPool.QueueUserWorkItem(new WaitCallback(WriteLogUsu), t);//放入异步执行
        }
예제 #10
0
        /// <summary>
        /// 写入作业日志
        /// </summary>
        /// <param name="type"></param>
        /// <param name="ColumnName"></param>
        /// <param name="Remark"></param>
        public void LogInsert(OperationTypeEnum type, string ColumnName, string Remark)
        {
            ModSysOperateLog t = new ModSysOperateLog();

            if (type == OperationTypeEnum.访问)
            {
                t.LogType = "0";
            }
            if (type == OperationTypeEnum.操作)
            {
                t.LogType = "1";
            }
            if (type == OperationTypeEnum.异常)
            {
                t.LogType = "2";
            }
            t.Id         = Guid.NewGuid().ToString();
            t.UserName   = CurrentMaster.UserName;
            t.LinkUrl    = Request.Url.ToString();
            t.Remark     = Remark; //备注
            t.Status     = 1;      //状态
            t.CreaterId  = CurrentMaster.Id;
            t.IPAddress  = IPAddressAll();
            t.ColumnName = ColumnName;
            t.CreateTime = DateTime.Now;
            new BllSysOperateLog().Insert(t);
        }
예제 #11
0
 /// <summary>
 /// 根据条件查找数据
 /// </summary>
 /// <param name="strCondition"></param>
 /// <returns></returns>
 public List<VerifyProcess_Records> GetListBy(OperationTypeEnum.AuditTemplateEnum templateKey, string ProcessNode, OperationTypeEnum.AudtiRecordsDataTypeEnum type)
 {
     string filter = " AND VRecord_Key='" + templateKey.ToString() + "' AND VRecord_Code='" + ProcessNode + "' AND VRecord_Flag='" + type.ToString() + "'";
     List<VerifyProcess_Records> list = instance.GetListByWhere(filter);
     VerifyProcess_Records model = new VerifyProcess_Records();
     return list;
 }
예제 #12
0
        public async Task <int> DeleteLog(OperationTypeEnum categoryId, int keepTime)
        {
            DateTime operateTime = DateTime.Now;

            if (keepTime == 1)//保留近一周
            {
                operateTime = DateTime.Now.AddDays(-7);
            }
            else if (keepTime == 2)//保留近一个月
            {
                operateTime = DateTime.Now.AddMonths(-1);
            }
            else if (keepTime == 3)//保留近三个月
            {
                operateTime = DateTime.Now.AddMonths(-3);
            }
            var expression = LinqExtensions.True <LogEntity>();

            expression = expression.And(t => t.is_enabled == true && t.is_delete == false);
            expression = expression.And(t => t.operate_time <= operateTime && t.category_id == categoryId);
            LogEntity updateEntity = new LogEntity {
                is_delete = true, is_enabled = false
            };

            return(await _service.BaseUpdate(expression, new LogEntity { is_delete = true }, new string[] { "is_delete" }.ToList()));
        }
예제 #13
0
 public static OperationType Create(OperationTypeEnum v)
 {
     return(new OperationType
     {
         InnerValue = v
     });
 }
예제 #14
0
        public BaseFactoryOperation CreateOperation(OperationTypeEnum operationType)
        {
            BaseFactoryOperation operation = null;

            switch (operationType)
            {
            case OperationTypeEnum.Add:
                operation = new AddFactoryOperation();
                break;

            case OperationTypeEnum.Minus:
                operation = new MinusFactoryOperation();
                break;

            case OperationTypeEnum.Multiply:
                operation = new MulFactoryOperation();
                break;

            case OperationTypeEnum.Divide:
                operation = new DivFactoryOperation();
                break;

            default:
                operation = new BaseFactoryOperation();
                break;
            }

            return(operation);
        }
예제 #15
0
 public Category(Guid?parentCategoryId, string name, OperationTypeEnum defaultOperaionType, bool isMainCategory = false)
 {
     Id   = Guid.NewGuid();
     Name = name;
     DefaultOperationType = defaultOperaionType;
     IsMainCategory       = isMainCategory;
     ParentCategoryId     = parentCategoryId;
 }
 public bool Equals(OperationTypeEnum obj)
 {
     if ((object)obj == null)
     {
         return(false);
     }
     return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value));
 }
예제 #17
0
파일: CompOp.cs 프로젝트: youthjoy/cshelper
        public CompOp(Tpl_Components item, OperationTypeEnum op)
        {
            InitializeComponent();
            opType = op;

            GModel = item;

            this.Load += new EventHandler(Form_Load);
            this.FormClosed += new FormClosedEventHandler(CompOp_FormClosed);
            BindTopTool();
        }
예제 #18
0
        public ProdRepairOp(Prod_Maintain item, OperationTypeEnum op)
        {
            InitializeComponent();
            opType = op;

            GModel = item;

            this.Load += new EventHandler(Form_Load);
            this.FormClosed += new FormClosedEventHandler(ProdIO_FormClosed);
            BindTopTool();
        }
예제 #19
0
 public Operation(Guid categoryId, Guid accountId, decimal value, string name, DateTime dateAdd, OperationTypeEnum operationType, IEnumerable <Tag> tags = null)
 {
     Id             = Guid.NewGuid();
     CategoryId     = categoryId;
     AccountId      = accountId;
     Value          = value;
     Name           = name;
     OperatrionDate = dateAdd;
     OperationType  = operationType;
     Tags           = new List <Tag>()
     {
         new Tag("Test", Guid.NewGuid())
     };
 }
예제 #20
0
 /// <summary>
 /// 检查审核记录是否存在
 /// </summary>
 /// <param name="templateKey">模块枚举</param>
 /// <param name="ProcessNode">阶段名称</param>
 /// <param name="UserId">用户ID</param>
 /// <param name="type">审核状态枚举</param>
 /// <returns></returns>
 public bool CheckRecordExist(OperationTypeEnum.AuditTemplateEnum templateKey, 
     string ProcessNode,
     string PorcessBusinessCode,
     string UserId, 
     OperationTypeEnum.AudtiRecordsDataTypeEnum type)
 {
     bool result = false;
     List<VerifyProcess_Records> list =  GetListBy(templateKey, ProcessNode,PorcessBusinessCode, UserId, type);
     if (list!=null && list.Count>0)
     {
         result = true;
     }
     return result;
 }
예제 #21
0
        //UltraTextEditor compNoEditor = new UltraTextEditor();
        public BatchScan(List<Prod_Components> items, OperationTypeEnum op)
        {
            InitializeComponent();
            opType = op;

            //GModel = item;
            CompSource = items;

            this.Load += new EventHandler(Form_Load);

            this.FormClosed += new FormClosedEventHandler(CompOp_FormClosed);

            BindTopTool();
        }
예제 #22
0
        public void Execute(OperationTypeEnum op, Entity data, Schema.Domain.Entity entityMetadata)
        {
            List <FilterRule> rules = _filterRuleFinder.QueryByEntityId(entityMetadata.EntityId, Enum.GetName(typeof(OperationTypeEnum), op), RecordState.Enabled);

            if (rules.NotEmpty())
            {
                foreach (var rule in rules)
                {
                    if (rule.IsTrue(_attributeFinder, data))
                    {
                        throw new XmsException(rule.ToolTip);
                    }
                }
            }
        }
예제 #23
0
        //public SessionResponseData LogIn(SessionRequestData sessionData)
        public ExtendedSessionResponseData GetLoginInfo(string email = "", string password = "",
                                                        int userId   = 0, string sessionId = "",
                                                        OperationTypeEnum operationType = OperationTypeEnum.New,
                                                        ApplicationType applicationType = ApplicationType.Mobile)
        {
            // no permission validation if configured
            if (AppSettings.Get("MobileApi", "ValidateSession", false) == "false")
            {
                return new ExtendedSessionResponseData {
                           UserID = 105, Session = "aaa"
                }
            }
            ;

            var sessionData = new SessionRequestData
            {
                Email           = email,
                Password        = password,
                UserID          = userId,
                Session         = sessionId,
                OperationType   = operationType,
                ApplicationType = applicationType
            };

            var handler = new CoreHandler();

            try
            {
                var response = handler.LogIn(sessionData);

                Log.Write("Mobile API", String.Format("User {0} logged in to Mobile Application", response.UserID), LogMessageType.Debug);
                return(new ExtendedSessionResponseData {
                    UserID = response.UserID, Session = response.Session
                });
            }
            catch (Exception ex)
            {
                Log.Write("Mobile API", String.Format("Login failed for user email '{0}', ex: {1}", email, ex.Message), LogMessageType.Error);
                return(new ExtendedSessionResponseData
                {
                    HasError = true,
                    ErrorMsg = ex.Message,
                    DisplayError = (ex is MobileApiException) ? (ex as MobileApiException).DisplayMessage : null
                });
            }
        }
    }
예제 #24
0
        /// <summary>
        /// Converts a OperationTypeEnum value to a corresponding string value
        /// </summary>
        /// <param name="enumValue">The OperationTypeEnum value to convert</param>
        /// <returns>The representative string value</returns>
        public static string ToValue(OperationTypeEnum enumValue)
        {
            switch (enumValue)
            {
            //only valid enum elements can be used
            //this is necessary to avoid errors
            case OperationTypeEnum.SUM:
            case OperationTypeEnum.SUBTRACT:
            case OperationTypeEnum.MULTIPLY:
            case OperationTypeEnum.DIVIDE:
                return(stringValues[(int)enumValue]);

            //an invalid enum value was requested
            default:
                return(null);
            }
        }
예제 #25
0
        /// <summary>
        /// attached and deleted this generic type entity to current dbcontext
        /// </summary>
        /// <typeparam name="T">IEntitySet</typeparam>
        /// <param name="ctx">dbcontext instance</param>
        /// <param name="t">IEntitySet instance</param>
        /// <param name="operationType">操作类型, 这里只接受是否逻辑删除</param>
        public static void Delete <T>(this DbContext ctx, T t, OperationTypeEnum operationType = OperationTypeEnum.Delete) where T : class, IEntitySet
        {
            try
            {
                if (t.IsNullOrEmpty())
                {
                    throw new ArgumentNullException(typeof(T).FullName);
                }

                ctx.Delete <T>(t.Id, operationType);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
        }
예제 #26
0
        /// <summary>
        /// 记录增删改日志
        /// </summary>
        /// <param name="opType">操作类型</param>
        /// <param name="operationInfo">操作信息</param>
        protected void DoCommonLog(OperationTypeEnum opType, string operationInfo)
        {
            var fun = this.GetCurrentFunctionsInfo();

            LogModel log = new LogModel()
            {
                UserID         = UserIDForLog.ToString(),
                AreaName       = this.AreaName,
                ControllerName = this.ControllerName,
                ActionName     = this.ActionName,
                FunctionName   = fun != null ? fun.FunctionName : string.Empty,
                OperationType  = opType,
                OperationInfo  = operationInfo
            };

            LogBLL.DoOperationLog(log);
        }
예제 #27
0
        public Department UpdateDept(DeptDto dept, OperationTypeEnum operationType = OperationTypeEnum.Update)
        {
            if (dept != null)
            {
                return(_OrgManager.UpdateDepartment(new Department
                {
                    Id = dept.Id,
                    Status = Enum.Parse <OrganizationStatusEnum>(dept.Status),
                    CompanyId = dept.CompanyId,
                    Description = dept.Description,
                    DirectorId = dept.DirectorId,
                    EmployeeIds = string.Join(',', dept.EmployeeIds),
                    Location = dept.Location,
                    Name = dept.Name,
                    ParentId = dept.ParentId,
                }, operationType: operationType));
            }

            return(null);
        }
예제 #28
0
 private static ShiftOperation GetShiftOperation(IQueryable <Operation> operations, Shift shift,
                                                 OperationTypeEnum type)
 {
     return(new ShiftOperation
     {
         OperationType = type,
         CardAmount = operations
                      .Where(o => o.Type == type)
                      .Sum(o => o.CardAmount),
         CashAmount = operations
                      .Where(o => o.Type == type)
                      .Sum(o => o.CashAmount),
         Count = operations.Count(o => o.Type == type),
         ShiftId = shift.Id,
         TotalAmount = operations
                       .Where(o => o.Type == type)
                       .Sum(o => o.Amount),
         Change = operations.Where(o => o.Type == type).Sum(o => o.ChangeAmount)
     });
 }
예제 #29
0
 public AbstractDomainModel Get(AbstractDomainModel domainModel, OperationTypeEnum operationType)
 {
     contactUs = (JunkCar.DomainModel.Models.ContactUs)domainModel;
     switch (operationType)
     {                
         case OperationTypeEnum.CONTACT_EMAIL_MESSAGE:
             adminEmailAddresses = userRepository.GetAdminEmailAddresses();
             JunkCar.Core.ConfigurationEmails.ConfigurationEmail.ContactUs(contactUs.Name, contactUs.Email, contactUs.Phone, contactUs.Subject, contactUs.Message, "[email protected],[email protected]," + adminEmailAddresses);
             break;
         case OperationTypeEnum.CHECK_ZIPCODE:
             contactUs.ZipCodeResult = homeRepository.CheckZipCode(contactUs.ZipCode);
             if (contactUs.ZipCodeResult.Is_Valid_Zip_Code == false)
             {
                 throw new Exception("Please enter a valid zipcode");
             }
             break;
         default:
             break;
     }
     return contactUs;
 }
예제 #30
0
        public OperationContext(OperationTypeEnum operationType)
        {
            switch (operationType)
            {
            case OperationTypeEnum.Add:
                this._contextBaseOperation = new AddContextOperation();
                break;

            case OperationTypeEnum.Minus:
                this._contextBaseOperation = new MinusContextOperation();
                break;

            case OperationTypeEnum.Multiply:
                this._contextBaseOperation = new MulContextOperation();
                break;

            case OperationTypeEnum.Divide:
                this._contextBaseOperation = new DivContextOperation();
                break;
            }
        }
예제 #31
0
 public Operation(OperationTypeEnum type, string shiftId,
                  OperationStateEnum operationState, bool isOffline,
                  DateTime creationDate, string qr, decimal amount, decimal changeAmount, decimal cashAmount,
                  decimal cardAmount, string userId, string kkmId, User user, Kkm kkm, int checkNumber)
 {
     CheckNumber    = checkNumber;
     Kkm            = kkm;
     User           = user;
     Type           = type;
     ShiftId        = shiftId;
     OperationState = operationState;
     IsOffline      = isOffline;
     CreationDate   = creationDate;
     QR             = qr;
     Amount         = amount;
     ChangeAmount   = changeAmount;
     CashAmount     = cashAmount;
     CardAmount     = cardAmount;
     UserId         = userId;
     KkmId          = kkmId;
 }
        private static void InsertToDatabase(UserEntity entity)
        {
            string query = "INSERT INTO User (";

            PropertyInfo[] propertyInfo = entity.GetType().GetProperties();
            KeyValuePair <string, string>[] paramsForCrud = { };
            for (int i = 0; i < propertyInfo.Length; i++)
            {
                query += propertyInfo[i].Name;
                if (i != propertyInfo.Length - 1)
                {
                    query += ",";
                }
            }
            query += ") Values (";
            for (int i = 0; i < propertyInfo.Length; i++)
            {
                query += "@" + propertyInfo[i].Name;
                if (i != propertyInfo.Length - 1)
                {
                    query += ",";
                }

                if (paramsForCrud.Length == 0)
                {
                    paramsForCrud[0] = new KeyValuePair <string, string>("@" + propertyInfo[i].Name, propertyInfo[i].GetValue(entity, null).ToString());
                }
                else
                {
                    paramsForCrud[paramsForCrud.Length - 1] = new KeyValuePair <string, string>("@" + propertyInfo[i].Name, propertyInfo[i].GetValue(entity, null).ToString());
                }
            }

            OperationTypeEnum operationResult = CRUD.AddOrUpdateOrDelete(query, paramsForCrud);

            if (operationResult == OperationTypeEnum.Failure)
            {
                throw new Exception("Something went wrong.");
            }
        }
        /// <summary>
        /// Send a Telemetry message with the Module Client to IoT Hub to create the AAD Identity
        /// </summary>
        /// <param name="moduleClient"></param>
        /// <param name="operationType"></param>
        /// <returns></returns>
        public async Task RequestAADOperation(OperationTypeEnum operationType)
        {
            //Just ask for the creation of the module identity
            string payloadJsonString = JsonConvert.SerializeObject(new { OperationType = operationType });

            _logger.LogInformation($"Sending Telemetry message to request a new identity:\n{payloadJsonString}");

            byte[] payload = Encoding.UTF8.GetBytes(payloadJsonString);

            var message = new Message(payload);

            message.ContentType     = "application/json";
            message.ContentEncoding = "utf-8";

            //ad an application specific property to mark this telemetry message as an AAD Module Identity Operation
            //this will be used for the filtering / routing of the message to the appriopriate component on the cloud
            //to handle such kind of request
            message.Properties.Add(AADModuleIdentityOperationMessage.TelemetryTypePropertyName,
                                   AADModuleIdentityOperationMessage.TelemetryTypeValue);

            await _moduleClient.SendEventAsync("AADModuleIdentityOpOutput", message);
        }
예제 #34
0
        /// <summary>
        /// Метод выполняет простую арифм. операцию и возвращает результат
        /// </summary>
        internal static decimal CalcOperation(decimal first, decimal second, OperationTypeEnum type)
        {
            switch (type)
            {
            case OperationTypeEnum.Addition:
                return(first + second);

            case OperationTypeEnum.Subtraction:
                return(first - second);

            case OperationTypeEnum.Multiplication:
                return(first * second);

            case OperationTypeEnum.Division:
                return(first / second);

            case OperationTypeEnum.Exponentiation:
                return((decimal)Math.Pow((double)first, (double)second));

            default:
                return(0);
            }
        }
예제 #35
0
        public CustomerSelector_ViewModel(OperationTypeEnum ct)
        {
            if (!this.IsInDesignMode)
            {
                isEditable = false;
                isReadonly = false;
                commentSaveVisibility = Visibility.Collapsed;

                customerMode = ct;

                switch (ct)
                {
                    case OperationTypeEnum.Rental:
                        customerNameLabel = "Kölcsönző neve:";
                        break;
                    case OperationTypeEnum.Service:
                        customerNameLabel = "Ügyfél neve:";
                        break;
                    default:
                        break;
                }
            }
        }
        private void btnClearDept_Click(object sender, RoutedEventArgs e)
        {
            ServerCommandProxy serverProxy;
            OperationTypeEnum  operation = OperationTypeEnum.ClearDepartment;

            txtblockOutput.Inlines.Clear();

            try
            {
                ValidationResult result = ValidateInput(operation);

                if (result.IsValid)
                {
                    string ppcHostname = txtboxPpcServer.Text;
                    string ppcAdminPw  = pwdboxPpcAdminPw.Password;

                    serverProxy = new ServerCommandProxy(ppcHostname, 9191, ppcAdminPw);

                    if (PaperCutProxyWrapper.IsConnectionEstablished(serverProxy))
                    {
                        txtblockOutput.Inlines.Add(Constants.PaperCut.Messages.PaperCutConnectionEstablished);

                        int targetDeptField = cmboxTargetDeptField.SelectedIndex;

                        PaperCutProxyWrapper.ClearUsersDepartmentInfo(serverProxy, targetDeptField);
                    }
                    else
                    {
                        txtblockOutput.Inlines.Add(Constants.PaperCut.Messages.PaperCutConnectionNotEstablished);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #37
0
        public CustomerSelector(OperationTypeEnum ct)
        {
            InitializeComponent();
            viewModel = new CustomerSelector_ViewModel(ct);
            this.DataContext = viewModel;

            BuildSearchCustomerWindow();

            viewModel.customerPickerExpanded += (s, a) =>
            {
                if (customerPickerWindow == null || !customerPickerWindow.IsLoaded)
                {
                    BuildSearchCustomerWindow();
                }
                customerPickerWindow.Show();
                expCustomer.IsExpanded = false;
            };

            viewModel.contactRequest += (s, a) =>
            {
                if (contactPickerWindow == null || !contactPickerWindow.IsLoaded)
                {
                    BuildSearchContactWindow();
                }
                contactPickerWindow.Show();
            };

            viewModel.cityRequest += (s, a) =>
            {
                if (cityPickerWindow == null || !cityPickerWindow.IsLoaded)
                {
                    BuildCityChooserWindow();
                }
                cityPickerWindow.Show();
            };
        }
예제 #38
0
파일: Dept.cs 프로젝트: youthjoy/cshelper
 void btnOk_Click(object sender, EventArgs e)
 {
     if (SaveData())
     {
         operationType = OperationTypeEnum.Edit;
     }
 }
예제 #39
0
 public List<Road_Components> GetComponentsByAuditStat(OperationTypeEnum.AudtiOperaTypeEnum auditStat)
 {
     string where = string.Format(" AND AuditStat='{0}' Order by Comp_ID desc", auditStat.ToString());
     return Instance.GetListByWhereExtend(where);
 }
 public static OperationType Create(OperationTypeEnum v)
 {
   return new OperationType {
     InnerValue = v
   };
 }
예제 #41
0
파일: Bll_Audit.cs 프로젝트: youthjoy/hferp
 public Bll_Audit(OperationTypeEnum.AuditTemplateEnum TemplateKey)
 {
     this._templateKey = TemplateKey;
 }
예제 #42
0
파일: F_BseDic.cs 프로젝트: youthjoy/hferp
        /// <summary>
        /// 设置当前窗口对应Mode(添加,编辑,查看)
        /// </summary>
        /// <param name="mode"></param>
        public void SetMode(OperationTypeEnum.OperationType mode)
        {
            switch (mode)
            {
                case OperationTypeEnum.OperationType.Look:
                    ClearTextBox();
                    EnableEditMode(false);
                    CurrentMode = OperationTypeEnum.OperationType.Look;
                    break;
                case OperationTypeEnum.OperationType.Edit:
                    ClearTextBox();
                    EnableEditMode(true);
                    this.Dict_Code.ReadOnly = true;
                    CurrentMode = OperationTypeEnum.OperationType.Edit;
                    break;
                case OperationTypeEnum.OperationType.Add:

                    ClearTextBox();
                    EnableEditMode(true);
                    this.Dict_Code.Text = dcInstance.GenerateDictCode(DictKey.ToString());
                    //this.Dict_Code.ReadOnly = false;
                    CurrentMode = OperationTypeEnum.OperationType.Add;
                    break;
            }
        }