Ejemplo n.º 1
0
        public Window1()
        {
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

            InitializeComponent();

            #if use_config_file
            CioConfiguration config = ConfigurationLoader.Load();
            #else
            CioConfiguration config = new CioConfiguration();
            config.RegisterServiceVisitor(new DisplayNameServiceVisitor());
            config.RegisterServiceVisitor(new EditableServiceVisitor());
            config.RegisterService(CreateDisplayNameService());

            config.Elements = new ElementConfiguration();
            #endif
            config.Elements.RegisterDefaultControls();

            IElementResolver resolver = config.Elements.CreateResolver();

            IFormBuilder formBuilder = new WpfFormBuilder(resolver);

            var form = new UserForm(config, formBuilder);

            User user = CreateUser();

            grid.Children.Add((UIElement)form.Render(user));
        }
Ejemplo n.º 2
0
        public FormRegionControls(Outlook.FormRegion region)
        {
            if (region != null)
            {
                try
                {
                    // 缓存对此区域及其
                    // 检查器以及此区域上的控件的引用。
                    _inspector = region.Inspector;
                    _form = region.Form as UserForm;
                    _ordersText = _form.Controls.Item(_ordersTextBoxName)
                        as Microsoft.Vbe.Interop.Forms.TextBox;
                    _coffeeList = _form.Controls.Item(_formRegionListBoxName)
                        as Outlook.OlkListBox;

                    // 使用任意字符串填充此列表框。
                    for (int i = 0; i < _listItems.Length; i++)
                    {
                        _coffeeList.AddItem(_listItems[i], i);
                    }
                    _coffeeList.Change += new
                        Outlook.OlkListBoxEvents_ChangeEventHandler(
                        _coffeeList_Change);
                }
                catch (COMException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                }
            }
        }
Ejemplo n.º 3
0
        public ActionResult Index(UserForm user)
        {
            if (ModelState.IsValid)
            {
                var userId = _userService.EnsureUserExists(user.Name, user.Email);
                FormsAuthentication.SetAuthCookie(userId.ToString(), false);
                return RedirectToAction("Blog");
            }

            return View(new IndexViewData(_userQuery.GetAll(), user));
        }
Ejemplo n.º 4
0
 private void buttonNovo_Click(object sender, EventArgs e)
 {
     UserForm user = new UserForm();
     if (user.ShowDialog() == DialogResult.OK)
     {
         if (AskGameStart != null)
         {
             AskGameStart(user.Nome);
         }
         if (AskToInitializeData != null)
         {
             AskToInitializeData();
         }
     }
 }
Ejemplo n.º 5
0
        private void OnShowUserForm(object sender, RoutedEventArgs e)
        {
            var window = new Window();
             var view = new UserFormView();

             Action<Person> onSubmit = p =>
             {
            window.Close();
            MessageBox.Show(string.Format("{0} (aged: {1} years) added!", p.Name, p.Age));
             };

             Action onCancel = window.Close;

             var viewModel = new UserForm("Add user", onSubmit, onCancel);
             view.DataContext = viewModel;
             window.Content = view;
             window.Show();
             window.BringIntoView();
        }
Ejemplo n.º 6
0
        public OperationResult CreateOrder(UserForm userForm, OrderData data, out string productName)
        {
            var result = new OperationResult();
            //尋找是否有可用Coupon
            CouponDetail couponDetail = CheckCoupon(data.AccountName, data.CouponDetailId);

            if (couponDetail == null)
            {
                data.CouponDetailId = null;
            }
            else
            {
                data.CouponDetailId = couponDetail.CouponDetailId;
            }
            byte?invoiceDonateTo;

            if (userForm.InvoiceDonateTo == null)
            {
                invoiceDonateTo = null;
            }
            else
            {
                invoiceDonateTo = byte.Parse(userForm.InvoiceDonateTo);
            }
            UserFavorite favorite = _repository.GetAll <UserFavorite>()
                                    .First(x => x.FavoriteId == data.FavoriteId);
            PackageProduct            package         = null;
            List <UserDefinedProduct> userDefinedList = null;

            if (favorite.IsPackage)
            {
                package     = GetPackage(favorite);
                productName = package.Name;
            }
            else
            {
                userDefinedList = GetUserDefinedList(favorite);
                productName     = userDefinedList[0].Name;
            }
            using (var transaction = _context.Database.BeginTransaction()) {
                try {
                    Order order = new Order {
                        OrderId         = Guid.NewGuid(),
                        AccountName     = data.AccountName,
                        FullName        = userForm.FullName,
                        Email           = userForm.Email,
                        Phone           = userForm.Phone,
                        DateService     = DateTime.Parse(userForm.DateService),
                        Address         = $"{userForm.County}{userForm.District}{userForm.Address}",
                        Remark          = userForm.Remark == null ? string.Empty : userForm.Remark,
                        OrderState      = (byte)OrderState.Unpaid,
                        Rate            = null,
                        Comment         = string.Empty,
                        CouponDetailId  = data.CouponDetailId,
                        PaymentType     = string.Empty,
                        InvoiceType     = byte.Parse(userForm.InvoiceType),
                        InvoiceDonateTo = invoiceDonateTo,
                        MerchantTradeNo = data.MerchantTradeNo,
                        TradeNo         = string.Empty,
                        CreateTime      = data.Now,
                        EditTime        = data.Now,
                        CreateUser      = data.AccountName,
                        EditUser        = data.AccountName,
                    };
                    _repository.Create <Order>(order);
                    _context.SaveChanges();

                    OrderDetail od = new OrderDetail {
                        OrderDetailId = Guid.NewGuid(),
                        OrderId       = order.OrderId,
                        FavoriteId    = data.FavoriteId,
                        FinalPrice    = data.FinalPrice,
                        ProductName   = productName,
                        CreateTime    = data.Now,
                        EditTime      = data.Now,
                        CreateUser    = data.AccountName,
                        EditUser      = data.AccountName,
                    };
                    _repository.Create <OrderDetail>(od);
                    _context.SaveChanges();

                    if (favorite.IsPackage)
                    {
                        List <int?> roomTypes = new List <int?> {
                            package.RoomType, package.RoomType2
                        };
                        if (package.RoomType3 >= 0)
                        {
                            roomTypes.Add(package.RoomType3);
                        }
                        List <int?> squareFeets = new List <int?> {
                            package.Squarefeet, package.Squarefeet2
                        };
                        if (package.Squarefeet3 >= 0)
                        {
                            squareFeets.Add(package.Squarefeet3);
                        }

                        OrderPackage orderPackage = new OrderPackage {
                            OrderId      = order.OrderId,
                            RoomTypes    = string.Join(",", roomTypes),
                            SquareFeets  = string.Join(",", squareFeets),
                            ServiceItems = package.ServiceItem,
                            Hour         = package.Hour,
                            Price        = package.Price,
                            CreateTime   = data.Now,
                            EditTime     = data.Now,
                            CreateUser   = data.AccountName,
                            EditUser     = data.AccountName,
                        };
                        _repository.Create <OrderPackage>(orderPackage);
                    }
                    else
                    {
                        foreach (var item in userDefinedList)
                        {
                            OrderUserDefined orderUserDefined = new OrderUserDefined {
                                OrderId      = order.OrderId,
                                RoomType     = item.RoomType,
                                SquareFeet   = item.Squarefeet,
                                ServiceItems = item.ServiceItems,
                                Hour         = item.Hour,
                                Price        = item.Price,
                                CreateTime   = data.Now,
                                EditTime     = data.Now,
                                CreateUser   = data.AccountName,
                                EditUser     = data.AccountName,
                            };
                            _repository.Create <OrderUserDefined>(orderUserDefined);
                        }
                    }
                    _context.SaveChanges();

                    if (couponDetail != null)
                    {
                        couponDetail.State = (int)UseState.Used;
                        _context.SaveChanges();
                    }

                    result.IsSuccessful = true;
                    transaction.Commit();
                } catch (Exception ex) {
                    result.IsSuccessful = false;
                    result.Exception    = ex;
                    transaction.Rollback();
                }
            }
            return(result);
        }
Ejemplo n.º 7
0
        private void btUserEditor_Click(object sender, EventArgs e)
        {
            UserForm u = new UserForm(mc);

            u.Show();
        }
		public BLResponse<User> SendUserForm(UserForm request, BLRequest blRequest)
		{
			return new BLResponse<User>(){Html = BuildUserForm().ToString()};
		}
Ejemplo n.º 9
0
 public Target Create(UserForm user)
 {
     return(null);
 }
 /// <exception cref="ArgumentNullException">form == null. -или- resultOfOperation == null.</exception>
 public abstract bool UpdateUserData(ref UserForm form, ResultOfOperation resultOfOperation);
Ejemplo n.º 11
0
        public ActionResult Create()
        {
            var userForm = new UserForm();

            return(View(userForm));
        }
Ejemplo n.º 12
0
        ///// <exception cref="ArgumentNullException">form == null. -или- ip == null. -или- resultOfOperation == null.</exception>
        ///// <exception cref="ArgumentOutOfRangeException">Строка не является ip адресом.</exception>
        //public override bool RegisterNewUser(UserForm form, IPAddress ip, ResultOfOperation resultOfOperation)
        //{
        //    if (form == null)
        //        throw new ArgumentNullException(nameof(form)) {Source = GetType().AssemblyQualifiedName};
        //    if (form.Login == null)
        //        throw new ArgumentNullException(nameof(form.Login));
        //    if (ip == null)
        //        throw new ArgumentNullException(nameof(ip)) {Source = GetType().AssemblyQualifiedName};
        //    if (resultOfOperation == null)
        //        throw new ArgumentNullException(nameof(resultOfOperation)) { Source = GetType().AssemblyQualifiedName };
        //    //IPAddress address;
        //    //if (!IPAddress.TryParse(ip, out address))
        //    //    throw new ArgumentOutOfRangeException(nameof(ip), "Строка не является ip адресом.")
        //    //{
        //    //    Source = GetType().AssemblyQualifiedName
        //    //};

        //    if (UsersF.Where((info => info.Login == form.Login)).Any())
        //        return CreateResultWithError(0, resultOfOperation, form.Login).OperationWasFinishedSuccessful;

        //    form.Ip = ip;
        //    //if (!form.ValidateBlobFormat(resultOfOperation, false, false))
        //    //    return false;
        //    if (! await Task.Run(() => form.ValidateIpAdressesAndPorts(3, false, resultOfOperation)).ConfigureAwait(false))
        //        return false;
        //    //if (form.DataForSymmetricAlgorithm == null)
        //    //    return CreateResultWithError(1, resultOfOperation).OperationWasFinishedSuccessful;
        //    //else
        //    //{
        //    //    if (form.DataForSymmetricAlgorithm.SymmetricIvBlob == null ||
        //    //        form.DataForSymmetricAlgorithm.SymmetricIvBlob.Length == 0 ||
        //    //        form.DataForSymmetricAlgorithm.SymmetricKeyBlob == null ||
        //    //        form.DataForSymmetricAlgorithm.SymmetricKeyBlob.Length == 0)
        //    //        return CreateResultWithError(2, resultOfOperation).OperationWasFinishedSuccessful;
        //    //}


        //    resultOfOperation.OperationWasFinishedSuccessful = true;
        //    UsersF.TryAdd(form);

        //    return true;
        //}
        /// <exception cref="ArgumentNullException">form == null. -или- ip == null. -или- resultOfOperation == null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Строка не является ip адресом.</exception>
        public override async Task <bool> RegisterNewUserAsync(UserForm form, IPAddress ip,
                                                               ResultOfOperation resultOfOperation)
        {
            var validateTask = Task.Run(() =>
            {
                if (form == null)
                {
                    throw new ArgumentNullException(nameof(form))
                    {
                        Source = GetType().AssemblyQualifiedName
                    }
                }
                ;
                if (ip == null)
                {
                    throw new ArgumentNullException(nameof(ip))
                    {
                        Source = GetType().AssemblyQualifiedName
                    }
                }
                ;
                if (resultOfOperation == null)
                {
                    throw new ArgumentNullException(nameof(resultOfOperation))
                    {
                        Source = GetType().AssemblyQualifiedName
                    }
                }
                ;

                var isExist = UsersF.Users.Any(surrogate => surrogate.Login == form.Login);
                if (isExist)
                {
                    return(CreateResultWithError(0, resultOfOperation, 0, form.Login).OperationWasFinishedSuccessful);
                }
                if (!ValidateUserFormForRegistration(form, resultOfOperation))
                {
                    return(false);
                }
                if (!form.ValidateIpAdressesAndPorts(3, false, resultOfOperation))
                {
                    return(false);
                }
                return(true);
            });

            if (!await validateTask.ConfigureAwait(false))
            {
                return(false);
            }
            try
            {
                await UsersF.Users.AddAsync(form).ConfigureAwait(false);

                await UsersF.SaveChangesAsync().ConfigureAwait(false);

                resultOfOperation.OperationWasFinishedSuccessful = true;
                return(resultOfOperation.OperationWasFinishedSuccessful);

                //seria
            }
            //catch (SerializationException ex)
            //    when (Type.GetType(ex.Source).GetTypeInfo().GetInterface("IFileEngine<UserForm>") != null)
            //{
            //    return CreateResultWithError(0, resultOfOperation, 5).OperationWasFinishedSuccessful;
            //}
            catch (SerializationException ex)
                when(
                    Type.GetType(ex.Source)
                    .GetTypeInfo()
                    .ImplementedInterfaces.FirstOrDefault(type => type.FullName.Contains("IFileEngine<UserForm>")) !=
                    null)
                {
                    return(CreateResultWithError(0, resultOfOperation, 5).OperationWasFinishedSuccessful);
                }
            //catch (IOException ex)
            //    when (Type.GetType(ex.Source).GetTypeInfo().GetInterface("IFileEngine<UserForm>") != null)
            //{
            //    return CreateResultWithError(0, resultOfOperation, 4).OperationWasFinishedSuccessful;
            //}
            catch (IOException ex)
                when(Type.GetType(ex.Source)
                     .GetTypeInfo()
                     .ImplementedInterfaces.FirstOrDefault(type => type.FullName.Contains("IFileEngine<UserForm>")) !=
                     null)
                {
                    return(CreateResultWithError(0, resultOfOperation, 4).OperationWasFinishedSuccessful);
                }
            catch (Exception ex)
            {
                return(CreateResultWithError(0, resultOfOperation, 6).OperationWasFinishedSuccessful);
            }
        }
Ejemplo n.º 13
0
 void InitUserFormMediator(UserForm userform)
 {
     base.ViewComponent         = userform;
     base.m_mediatorName        = NAME;
     userform.BtnConfirmAction += BtnConfirmActionClick;
 }
Ejemplo n.º 14
0
        private static UserTask CreateRegisterNewPartyTask()
        {
            var form = new UserForm
            {
                Id     = "Form_2",
                Fields = new List <FormField>
                {
                    new FormField
                    {
                        Id                 = "Form_2_Field_1",
                        DisplayName        = "Name",
                        Type               = FormFieldType.Property,
                        PropertyExpression = "Property_13"
                    },
                    new FormField
                    {
                        Id                 = "Form_2_Field_2",
                        DisplayName        = "Code",
                        Type               = FormFieldType.Property,
                        PropertyExpression = "Property_14"
                    },
                    new FormField
                    {
                        Id                 = "Form_2_Field_3",
                        DisplayName        = "Website",
                        Type               = FormFieldType.Property,
                        PropertyExpression = "Property_15"
                    },
                    new FormField
                    {
                        Id                 = "Form_2_Field_4",
                        DisplayName        = "CountryId",
                        Type               = FormFieldType.Property,
                        PropertyExpression = "Property_51"
                    }
                }
            };
            var incoming = new List <string>()
            {
                "Sequence_Flow_2"
            };

            var outgoing = new List <string>()
            {
                "Sequence_Flow_3"
            };

            return(new UserTask
            {
                Id = "User_Task_1",
                Incoming = incoming,
                Outgoing = outgoing,
                InstanceType = InstanceType.Parallel,
                LoopCardinality = -1,
                Name = "Register New Party",
                Form = form,
                ValidationScript = @"require(politicalParties[msg.sender].id == address(0));

        PoliticalParty memory party = PoliticalParty({
            id: msg.sender,
            name: name,
            code: code,
            website: website,
            voteCount: 0,
            allocatedSeats: 0,
            countryId: countryId
        });
        politicalParties[msg.sender] = party;
        politicalPartiesKeys.push(msg.sender);"
            });
        }
Ejemplo n.º 15
0
 public JsonResult Form(UserForm form, HttpPostedFileBase image, string imagePath)
 {
     return(SaveChanges(form, Facade <UserFacade>().AddUser));
 }
Ejemplo n.º 16
0
        private static UserTask CreateRegisterCandidateTask()
        {
            var form = new UserForm
            {
                Id     = "Form_3",
                Fields = new List <FormField>
                {
                    new FormField
                    {
                        Id                 = "Form_3_Field_1",
                        DisplayName        = "Party Id",
                        Type               = FormFieldType.Property,
                        PropertyExpression = "Property_12",
                        IsReadOnly         = true
                    },
                    new FormField
                    {
                        Id                 = "Form_3_Field_2",
                        DisplayName        = "name",
                        Type               = FormFieldType.Property,
                        PropertyExpression = "Property_19"
                    },
                    new FormField
                    {
                        Id                 = "Form_3_Field_3",
                        DisplayName        = "website",
                        Type               = FormFieldType.Property,
                        PropertyExpression = "Property_20"
                    }
                }
            };

            return(new UserTask
            {
                Id = "User_Task_2",
                Incoming = new List <string> {
                    "Sequence_Flow_3", "Sequence_Flow_4"
                },
                Outgoing = new List <string> {
                    "Sequence_Flow_5"
                },
                InstanceType = InstanceType.Parallel,
                LoopCardinality = -1,
                Name = "Register New Candidate",
                Form = form,
                ValidationScript = @"PoliticalParty storage party = politicalParties[partyId];
        //check whether a party exists
        require(bytes(party.name).length > 0);
        //check whether a candidate is not already registered to this address
        require(candidates[msg.sender].id == address(0));
        
        Candidate memory candidate = Candidate({
            id: msg.sender,
            name: name,
            website: website, 
            voteCount: 0, 
            hasSeat: false,
            approved: false,
            partyId: party.id
        });
        
        candidatesKeys.push(msg.sender);
        candidates[msg.sender] = candidate;"
            });
        }
Ejemplo n.º 17
0
 public static UserForm CreateUserForm(int id)
 {
     UserForm userForm = new UserForm();
     userForm.ID = id;
     return userForm;
 }
Ejemplo n.º 18
0
 public void AddToUserForm(UserForm userForm)
 {
     base.AddObject("UserForm", userForm);
 }
Ejemplo n.º 19
0
        public static void GetFrom()
        {
            if (GetPublicXmlValue("isShowFormItem", false) == "0")
            {
                IEnumerable <XElement> enumerable = UrlManage.id_dllSettingDoc.Root.Elements("FormItem");
                if (enumerable != null)
                {
                    foreach (XElement element in enumerable)
                    {
                        UserForm item = new UserForm {
                            text       = element.Attribute("text")?.Value,
                            type       = element.Attribute("type")?.Value,
                            imageType  = element.Attribute("imageType")?.Value,
                            ClickUrl   = element.Attribute("ClickUrl")?.Value,
                            statistics = (element.Attribute("statistics") == null) ? 0 : int.Parse(element.Attribute("statistics").Value)
                        };
                        item.AccessibleDescription = item.text;
                        item.AutoSize        = true;
                        item.Text            = "";
                        item.FormBorderStyle = FormBorderStyle.None;
                        item.isShow          = element.Attribute("isShow")?.Value;
                        item.ClassName       = element.Attribute("ClassName")?.Value;
                        item.WindowName      = element.Attribute("WindowName")?.Value;
                        char[] separator = new char[] { ',' };
                        char[] chArray2  = new char[] { ',' };
                        item.location1 = new Point(int.Parse(element.Attribute("location1")?.Value.Split(separator)[0]), int.Parse(element.Attribute("location1")?.Value.Split(chArray2)[1]));
                        char[] chArray3 = new char[] { ',' };
                        char[] chArray4 = new char[] { ',' };
                        item.size1 = new Size(int.Parse(element.Attribute("size1")?.Value.Split(chArray3)[0]), int.Parse(element.Attribute("size1")?.Value.Split(chArray4)[1]));
                        char[] chArray5 = new char[] { ',' };
                        char[] chArray6 = new char[] { ',' };
                        item.location2 = new Point(int.Parse(element.Attribute("location2")?.Value.Split(chArray5)[0]), int.Parse(element.Attribute("location2")?.Value.Split(chArray6)[1]));
                        char[] chArray7 = new char[] { ',' };
                        char[] chArray8 = new char[] { ',' };
                        item.size2 = new Size(int.Parse(element.Attribute("size2")?.Value.Split(chArray7)[0]), int.Parse(element.Attribute("size2")?.Value.Split(chArray8)[1]));
                        char[] chArray9  = new char[] { ',' };
                        char[] chArray10 = new char[] { ',' };
                        item.location3 = new Point(int.Parse(element.Attribute("location3")?.Value.Split(chArray9)[0]), int.Parse(element.Attribute("location3")?.Value.Split(chArray10)[1]));
                        char[] chArray11 = new char[] { ',' };
                        char[] chArray12 = new char[] { ',' };
                        item.size3 = new Size(int.Parse(element.Attribute("size3")?.Value.Split(chArray11)[0]), int.Parse(element.Attribute("size3")?.Value.Split(chArray12)[1]));

                        item.image      = UrlManage.SetImage(element.Attribute("image")?.Value, item.imageType);
                        item.hoverimage = UrlManage.SetImage(element.Attribute("hoverimage")?.Value, item.imageType);
                        char[] chArray13 = new char[] { ',' };
                        char[] chArray14 = new char[] { ',' };
                        item.hideLocation1 = new Point(int.Parse(element.Attribute("hideLocation1")?.Value.Split(chArray13)[0]), int.Parse(element.Attribute("hideLocation1")?.Value.Split(chArray14)[1]));
                        char[] chArray15 = new char[] { ',' };
                        char[] chArray16 = new char[] { ',' };
                        item.hideLocation2 = new Point(int.Parse(element.Attribute("hideLocation2")?.Value.Split(chArray15)[0]), int.Parse(element.Attribute("hideLocation2")?.Value.Split(chArray16)[1]));
                        char[] chArray17 = new char[] { ',' };
                        char[] chArray18 = new char[] { ',' };
                        item.hideLocation3 = new Point(int.Parse(element.Attribute("hideLocation3")?.Value.Split(chArray17)[0]), int.Parse(element.Attribute("hideLocation3")?.Value.Split(chArray18)[1]));
                        item.hideColor1    = element.Attribute("hideColor1")?.Value;
                        item.hideColor2    = element.Attribute("hideColor2")?.Value;
                        item.hideColor3    = element.Attribute("hideColor3")?.Value;
                        UserPicturebox picturebox = new UserPicturebox {
                            Statistics      = item.statistics,
                            ClickUrl        = item.ClickUrl,
                            Dock            = DockStyle.Fill,
                            Cursor          = Cursors.Hand,
                            GameType        = item.type,
                            SizeMode        = PictureBoxSizeMode.StretchImage,
                            Image           = item.image,
                            BackgroundImage = item.hoverimage
                        };
                        picturebox.Click      += new EventHandler(XmlHelper.FormItem_Click);
                        picturebox.MouseEnter += new EventHandler(XmlHelper.FormItem_MouseLeaveAndMouseEnter);
                        picturebox.MouseLeave += new EventHandler(XmlHelper.FormItem_MouseLeaveAndMouseEnter);
                        string str = element.Attribute("closeimage")?.Value;
                        if (!string.IsNullOrEmpty(str))
                        {
                            PictureBox box = new PictureBox {
                                Cursor   = Cursors.Hand,
                                SizeMode = PictureBoxSizeMode.StretchImage
                            };
                            char[] chArray19 = new char[(element.Attribute("closeSize")?.Value == null) ? 0 : 1];
                            chArray19[0] = ',';
                            string[] strArray = element.Attribute("closeSize")?.Value.Split(chArray19);
                            box.Size     = new Size(int.Parse(strArray[0].ToString()), int.Parse(strArray[1].ToString()));
                            box.Location = new Point(0, 0);
                            box.Click   += new EventHandler(XmlHelper.Close_Click);
                            box.Image    = UrlManage.SetImage(str, "png");
                            box.BringToFront();
                            box.Width  = box.Size.Width;
                            box.Height = box.Size.Height;
                            picturebox.Controls.Add(box);
                        }
                        item.Controls.Add(picturebox);
                        if ((item.isShow == "0") && (item != null))
                        {
                            UrlManage.__FormsList.Add(item);
                        }
                    }
                }
            }
        }
Ejemplo n.º 20
0
        /// <exception cref="ArgumentNullException">form == null. -или- names == null.</exception>
        public override async Task <ICollection <UserFormSurrogate> > GetUsersPublicData(IEnumerable <string> names, UserForm form)
        {
            if (names == null)
            {
                throw new ArgumentNullException(nameof(names))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;

            //var resultSurs =
            //    await UsersF.AccesForms.Where(
            //            accesForm => accesForm.TempUsers.Contains(form.Login) || accesForm.ConstUsers.Contains(form.Login))
            //        .ToArrayAsync().ConfigureAwait(false);
            //var resultForms = resultSurs.Select(sur => ((UserForm) sur.UserForm).GetUserPublicData()).ToArray();
            //var resultSurs = await UsersF.Users.Select(surrogate => surrogate.Login).Join(names, s => s, s => s, (s, s1) => s).
            var resultSursFromDb = await
                                   UsersF.Users.Include(surrogate => surrogate.Accessibility)
                                   .Where(
                surrogate => names.Contains(surrogate.Login))
                                   .ToArrayAsync().ConfigureAwait(false);

            var resultSurs = resultSursFromDb.Where(
                surrogate =>
                surrogate.Accessibility.IsPublicProfile ||
                surrogate.Accessibility.ConstUsers.Contains(form.Login) ||
                surrogate.Accessibility.TempUsers.Contains(form.Login)).ToArray();

            //var resultSurs =
            //    await
            //        UsersF.Users.Join(names, surrogate => surrogate.Login, s => s, (surrogate, s) => surrogate)
            //            .Where(
            //                surrogate =>
            //                    surrogate.Accessibility.IsPublicProfile ||
            //                    surrogate.Accessibility.ConstUsers.Contains(form.Login) ||
            //                    surrogate.Accessibility.TempUsers.Contains(form.Login))
            //            .ToArrayAsync().ConfigureAwait(false);
            return(resultSurs);
        }
Ejemplo n.º 21
0
        public JsonResult Delete([FromBody] UserForm userForm)
        {
            var res = _userService.Delete(userForm);

            return(Json(res));
        }
Ejemplo n.º 22
0
        /// <exception cref="ArgumentNullException">formOfSender == null. -или- OfflineMessageForm == null. -или-
        /// resultOfOperation == null.</exception>
        public override bool SendOfflineMessage(OfflineMessageForm offlineMessage, UserForm formOfSender,
                                                ResultOfOperation resultOfOperation)
        {
            if (formOfSender == null)
            {
                throw new ArgumentNullException(nameof(formOfSender))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;
            if (offlineMessage == null)
            {
                throw new ArgumentNullException(nameof(offlineMessage))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;
            if (resultOfOperation == null)
            {
                throw new ArgumentNullException(nameof(resultOfOperation))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;

            try
            {
                var receiver = (UserForm)UsersF.Users.First((form => form.Login == offlineMessage.LoginOfReciever));
                while (true)
                {
                    OfflineMessagesConcurent messages;
                    if (!receiver.ValidateIpAdressesAndPorts(1, false, resultOfOperation))
                    {
                        //OfflineMessagesConcurent messagesConcurentOffline;
                        if (OfflineMessagesF.TryGetValue(receiver.Login, out messages))
                        {
                            if (messages.Count > 50)
                            {
                                resultOfOperation.ErrorMessage = "Кол-во сообщений для офлайн пользователей не может превышать 50.";
                                resultOfOperation.OperationWasFinishedSuccessful = false;
                                return(false);
                            }
                            //messagesConcurentOffline =
                            //    messages.Where(
                            //            offlineMessages => offlineMessages.FormOfSender.Login.Equals(formOfSender.Login))
                            //        .ToArray()[0];

                            //if (messagesConcurentOffline == null)
                            //{
                            //    messagesConcurentOffline = new OfflineMessagesConcurent(formOfSender);
                            //    messages.Add(messagesConcurentOffline);
                            //}
                            messages.Add(formOfSender.Login, offlineMessage.Message);

                            //messagesConcurentOffline.Messages.Add(offlineMessage.Message);
                            resultOfOperation.OperationWasFinishedSuccessful = true;
                            return(true);
                        }
                        else
                        {
                            while (true)
                            {
                                messages = new OfflineMessagesConcurent(offlineMessage.LoginOfReciever);
                                if (OfflineMessagesF.TryAdd(offlineMessage.LoginOfReciever, messages))
                                {
                                    messages.Add(formOfSender.Login, offlineMessage.Message);
                                    break;
                                }
                                else
                                {
                                    if (OfflineMessagesF.TryGetValue(receiver.Login, out messages))
                                    {
                                        messages.Add(formOfSender.Login, offlineMessage.Message);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        resultOfOperation.ErrorMessage = "Пользователь находится в сети.";
                        resultOfOperation.OperationWasFinishedSuccessful = false;
                        return(false);
                    }
                }
            }
            catch (InvalidOperationException)
            {
                resultOfOperation.ErrorMessage = "Пользователь получатель не зарегистрирован.";
                resultOfOperation.OperationWasFinishedSuccessful = false;
                return(false);
            }
        }
 /// <exception cref="ArgumentNullException">form == null. -или- names == null.</exception>
 public abstract Task <ICollection <UserFormSurrogate> > GetUsersPublicData(IEnumerable <string> names, UserForm form);
Ejemplo n.º 24
0
        private void MenuUserUToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UserForm form = new UserForm();

            ShowFormControl(form, "사용자 관리");
        }
 /// <exception cref="ArgumentNullException">formOfSender == null. -или- OfflineMessageForm == null. -или-
 /// resultOfOperation == null.</exception>
 public abstract bool SendOfflineMessage(OfflineMessageForm offlineMessage, UserForm formOfSender,
                                         ResultOfOperation resultOfOperation);
Ejemplo n.º 26
0
 public IndexViewData(IList<User> users, UserForm userForm)
 {
     Users = users;
     UserForm = userForm;
 }
        public ActionResult AddOrder(UserForm post)
        {
            DateTime now = DateTime.Now;
            string   accountName;
            string   productName;
            string   url = WebConfigurationManager.AppSettings["WebsiteUrl"];
            string   merchantTradeNo;
            Guid     favoriteId;
            decimal  finalAmount;
            Guid?    couponDetailId;

            if (post.CouponDetailId == null)
            {
                couponDetailId = null;
            }
            else
            {
                couponDetailId = Guid.Parse(post.CouponDetailId);
            }
            try {
                accountName = Helpers.DecodeCookie(Request.Cookies["user"]["user_accountname"]);
                favoriteId  = Guid.Parse(post.FavoriteId);
                _checkoutService.CheckAccountExist(accountName);
                _checkoutService.CheckFavoriteId(accountName, favoriteId);
                finalAmount = _checkoutService.GetTotalPrice(favoriteId);

                if (couponDetailId != null)
                {
                    finalAmount -= _checkoutService.GetDiscountAmount(couponDetailId);
                }

                merchantTradeNo = _checkoutService.GetNextMerchantTradeNo();
                OrderData orderData = new OrderData {
                    AccountName     = accountName,
                    FavoriteId      = favoriteId,
                    CouponDetailId  = couponDetailId,
                    FinalPrice      = finalAmount,
                    MerchantTradeNo = merchantTradeNo,
                    Now             = now,
                };
                var result = _checkoutService.CreateOrder(post, orderData, out productName);

                if (result.IsSuccessful)
                {
                    _checkoutService.SaveMerchantTradeNo(merchantTradeNo);
                }
                else
                {
                    throw new Exception("訂單建立失敗");
                }
            } catch (Exception ex) {
                return(Json(ex.Message));
            }

            ECPayForm ecpayForm = new ECPayForm();

            ecpayForm.ChoosePayment     = "ALL";
            ecpayForm.EncryptType       = "1";
            ecpayForm.ItemName          = "uCleaner打掃服務";
            ecpayForm.MerchantID        = "2000132";
            ecpayForm.MerchantTradeDate = now.ToString("yyyy/MM/dd HH:mm:ss");
            ecpayForm.MerchantTradeNo   = merchantTradeNo;
            ecpayForm.OrderResultURL    = url + "/Checkout/SuccessView";
            ecpayForm.PaymentType       = "aio";
            ecpayForm.ReturnURL         = url + "/Checkout/ECPayReturn";
            ecpayForm.TotalAmount       = Math.Round(finalAmount).ToString();
            ecpayForm.TradeDesc         = HttpUtility.UrlEncode(productName);

            string HashKey = "5294y06JbISpM5x9";
            string HashIV  = "v77hoKGq4kWxNNIS";
            Dictionary <string, string> paramList = new Dictionary <string, string> {
                { "ChoosePayment", ecpayForm.ChoosePayment },
                //{ "ClientBackURL", ecpayForm.ClientBackURL },
                { "EncryptType", ecpayForm.EncryptType },
                { "ItemName", ecpayForm.ItemName },
                { "MerchantID", ecpayForm.MerchantID },
                { "MerchantTradeDate", ecpayForm.MerchantTradeDate },
                { "MerchantTradeNo", ecpayForm.MerchantTradeNo },
                { "OrderResultURL", ecpayForm.OrderResultURL },
                { "PaymentType", ecpayForm.PaymentType },
                { "ReturnURL", ecpayForm.ReturnURL },
                { "TotalAmount", ecpayForm.TotalAmount },
                { "TradeDesc", ecpayForm.TradeDesc },
            };
            string Parameters = string.Join("&", paramList.Select(x => $"{x.Key}={x.Value}").OrderBy(x => x));

            ecpayForm.CheckMacValue = GetCheckMacValue(HashKey, Parameters, HashIV);

            return(Json(ecpayForm));
        }
Ejemplo n.º 28
0
 public FormConsole(UserForm userForm)
 {
     form = userForm;
 }
Ejemplo n.º 29
0
 public Target Update(UserForm user)
 {
     return(null);
 }
Ejemplo n.º 30
0
        public void openUsersForm()
        {
            UserForm uf = new UserForm();

            uf.Show();
        }
Ejemplo n.º 31
0
        /// <summary>
        /// This method creates any entity records that this sample requires.
        /// Creates the email activity.
        /// </summary>
        public static void CreateRequiredRecords(CrmServiceClient service)
        {
            //Grab the default public view for opportunities.
            var mySavedQuery = new QueryExpression
            {
                ColumnSet  = new ColumnSet("savedqueryid"),
                EntityName = SavedQuery.EntityLogicalName,
                Criteria   = new FilterExpression
                {
                    Conditions =
                    {
                        new ConditionExpression
                        {
                            AttributeName = "isdefault",
                            Operator      = ConditionOperator.Equal,
                            Values        = { true   }
                        },
                        new ConditionExpression
                        {
                            AttributeName = "querytype",
                            Operator      = ConditionOperator.Equal,
                            Values        = {      0 }
                        },
                        new ConditionExpression
                        {
                            AttributeName = "returnedtypecode",
                            Operator      = ConditionOperator.Equal,
                            Values        = { Opportunity.EntityTypeCode }
                        }
                    }
                }
            };

            //This query should return one and only one result.
            SavedQuery defaultOpportunityQuery = service.RetrieveMultiple(mySavedQuery)
                                                 .Entities.Select(x => (SavedQuery)x).FirstOrDefault();

            // Retrieve visualizations out of the system.
            // This sample assumes that you have the "Top Opportunities"
            // visualization that is installed with Microsoft Dynamics CRM.
            QueryByAttribute visualizationQuery = new QueryByAttribute
            {
                EntityName = SavedQueryVisualization.EntityLogicalName,
                ColumnSet  = new ColumnSet("savedqueryvisualizationid"),
                Attributes = { "name" },
                //If you do not have this visualization, you will need to change
                //this line.
                Values = { "Top Opportunities" }
            };


            SavedQueryVisualization visualization = service.RetrieveMultiple(visualizationQuery).
                                                    Entities.Select(x => (SavedQueryVisualization)x).FirstOrDefault();

            //This is the language code for U.S. English. If you are running this code
            //in a different locale, you will need to modify this value.
            int languageCode = 1033;

            //We set up our dashboard and specify the FormXml. Refer to the
            //FormXml schema in the Microsoft Dynamics CRM SDK for more information.
            UserForm dashboard = new UserForm
            {
                Name        = "Sample User Dashboard",
                Description = "Sample user-owned dashboard.",
                FormXml     = String.Format(@"<form>
                                <tabs>
                                    <tab name='Test Dashboard' verticallayout='true'>
                                        <labels>
                                            <label description='Sample User Dashboard' languagecode='{0}' />
                                        </labels>
                                        <columns>
                                            <column width='100%'>
                                                <sections>
                                                    <section name='Information Section'
                                                        showlabel='false' showbar='false'
                                                        columns='111'>
                                                        <labels>
                                                            <label description='Information Section'
                                                                languagecode='{0}' />
                                                        </labels>
                                                        <rows>
                                                            <row>
                                                                <cell colspan='1' rowspan='10' 
                                                                    showlabel='false'>
                                                                    <labels>
                                                                        <label description='Top Opportunities - 1'
                                                                        languagecode='{0}' />
                                                                    </labels>
                                                                    <control id='Top10Opportunities'
                                                                        classid='{{E7A81278-8635-4d9e-8D4D-59480B391C5B}}'>
                                                                        <parameters>
                                                                            <ViewId>{1}</ViewId>
                                                                            <IsUserView>false</IsUserView>
                                                                            <RelationshipName />
                                                                            <TargetEntityType>opportunity</TargetEntityType>
                                                                            <AutoExpand>Fixed</AutoExpand>
                                                                            <EnableQuickFind>false</EnableQuickFind>
                                                                            <EnableViewPicker>false</EnableViewPicker>
                                                                            <EnableJumpBar>false</EnableJumpBar>
                                                                            <ChartGridMode>Chart</ChartGridMode>
                                                                            <VisualizationId>{2}</VisualizationId>
                                                                            <EnableChartPicker>false</EnableChartPicker>
                                                                            <RecordsPerPage>10</RecordsPerPage>
                                                                        </parameters>
                                                                    </control>
                                                                </cell>
                                                                <cell colspan='1' rowspan='10' 
                                                                    showlabel='false'>
                                                                    <labels>
                                                                        <label description='Top Opportunities - 2'
                                                                        languagecode='{0}' />
                                                                    </labels>
                                                                    <control id='Top10Opportunities2'
                                                                        classid='{{E7A81278-8635-4d9e-8D4D-59480B391C5B}}'>
                                                                        <parameters>
                                                                            <ViewId>{1}</ViewId>
                                                                            <IsUserView>false</IsUserView>
                                                                            <RelationshipName />
                                                                            <TargetEntityType>opportunity</TargetEntityType>
                                                                            <AutoExpand>Fixed</AutoExpand>
                                                                            <EnableQuickFind>false</EnableQuickFind>
                                                                            <EnableViewPicker>false</EnableViewPicker>
                                                                            <EnableJumpBar>false</EnableJumpBar>
                                                                            <ChartGridMode>Grid</ChartGridMode>
                                                                            <VisualizationId>{2}</VisualizationId>
                                                                            <EnableChartPicker>false</EnableChartPicker>
                                                                            <RecordsPerPage>10</RecordsPerPage>
                                                                        </parameters>
                                                                    </control>
                                                                </cell>
                                                            </row>
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                        </rows>
                                                    </section>
                                                </sections>
                                            </column>
                                        </columns>
                                    </tab>
                                </tabs>
                            </form>",
                                            languageCode,
                                            defaultOpportunityQuery.SavedQueryId.Value.ToString("B"),
                                            visualization.SavedQueryVisualizationId.Value.ToString("B"))
            };

            _userDashboardId = service.Create(dashboard);

            Console.WriteLine("Created {0}.", dashboard.Name);

            // Create another user to whom the dashboard will be assigned.
            _otherUserId = SystemUserProvider.RetrieveSalesManager(service);

            Console.WriteLine("Required records have been created.");
        }
Ejemplo n.º 32
0
        /// <summary>
        /// This method creates any entity records that this sample requires.
        /// Creates the dashboard.
        /// </summary>
        public void CreateRequiredRecords()
        {
            //Grab the default public view for opportunities.
            QueryExpression mySavedQuery = new QueryExpression
            {
                ColumnSet = new ColumnSet("savedqueryid"),
                EntityName = SavedQuery.EntityLogicalName,
                Criteria = new FilterExpression
                {
                    Conditions =
                        {
                            new ConditionExpression
                            {
                                AttributeName = "isdefault",
                                Operator = ConditionOperator.Equal,
                                Values = {true}
                            },
                            new ConditionExpression
                            {
                                AttributeName = "querytype",
                                Operator = ConditionOperator.Equal,
                                Values = {0}
                            },
                            new ConditionExpression
                            {
                                AttributeName = "returnedtypecode",
                                Operator = ConditionOperator.Equal,
                                Values = {Opportunity.EntityTypeCode}
                            }
                        }
                }
            };

            //This query should return one and only one result.
            SavedQuery defaultOpportunityQuery = _serviceProxy.RetrieveMultiple(mySavedQuery)
                .Entities.Select(x => (SavedQuery)x).FirstOrDefault();

            // Retrieve visualizations out of the system. 
            // This sample assumes that you have the "Top Opportunities"
            // visualization that is installed with Microsoft Dynamics CRM.
            QueryByAttribute visualizationQuery = new QueryByAttribute
            {
                EntityName = SavedQueryVisualization.EntityLogicalName,
                ColumnSet = new ColumnSet("savedqueryvisualizationid"),
                Attributes = { "name" },
                //If you do not have this visualization, you will need to change
                //this line.
                Values = { "Top Opportunities" }
            };


            SavedQueryVisualization visualization = _serviceProxy.RetrieveMultiple(visualizationQuery).
                Entities.Select(x => (SavedQueryVisualization)x).FirstOrDefault();

            //This is the language code for U.S. English. If you are running this code
            //in a different locale, you will need to modify this value.
            int languageCode = 1033;

            //We set up our dashboard and specify the FormXml. Refer to the
            //FormXml schema in the Microsoft Dynamics CRM SDK for more information.
            UserForm dashboard = new UserForm
            {
                Name = "Sample User Dashboard",
                Description = "Sample user-owned dashboard.",
                FormXml = String.Format(@"<form>
                                <tabs>
                                    <tab name='Test Dashboard' verticallayout='true'>
                                        <labels>
                                            <label description='Sample User Dashboard' languagecode='{0}' />
                                        </labels>
                                        <columns>
                                            <column width='100%'>
                                                <sections>
                                                    <section name='Information Section'
                                                        showlabel='false' showbar='false'
                                                        columns='111'>
                                                        <labels>
                                                            <label description='Information Section'
                                                                languagecode='{0}' />
                                                        </labels>
                                                        <rows>
                                                            <row>
                                                                <cell colspan='1' rowspan='10' 
                                                                    showlabel='false'>
                                                                    <labels>
                                                                        <label description='Top Opportunities - 1'
                                                                        languagecode='{0}' />
                                                                    </labels>
                                                                    <control id='Top10Opportunities'
                                                                        classid='{{E7A81278-8635-4d9e-8D4D-59480B391C5B}}'>
                                                                        <parameters>
                                                                            <ViewId>{1}</ViewId>
                                                                            <IsUserView>false</IsUserView>
                                                                            <RelationshipName />
                                                                            <TargetEntityType>opportunity</TargetEntityType>
                                                                            <AutoExpand>Fixed</AutoExpand>
                                                                            <EnableQuickFind>false</EnableQuickFind>
                                                                            <EnableViewPicker>false</EnableViewPicker>
                                                                            <EnableJumpBar>false</EnableJumpBar>
                                                                            <ChartGridMode>Chart</ChartGridMode>
                                                                            <VisualizationId>{2}</VisualizationId>
                                                                            <EnableChartPicker>false</EnableChartPicker>
                                                                            <RecordsPerPage>10</RecordsPerPage>
                                                                        </parameters>
                                                                    </control>
                                                                </cell>
                                                                <cell colspan='1' rowspan='10' 
                                                                    showlabel='false'>
                                                                    <labels>
                                                                        <label description='Top Opportunities - 2'
                                                                        languagecode='{0}' />
                                                                    </labels>
                                                                    <control id='Top10Opportunities2'
                                                                        classid='{{E7A81278-8635-4d9e-8D4D-59480B391C5B}}'>
                                                                        <parameters>
                                                                            <ViewId>{1}</ViewId>
                                                                            <IsUserView>false</IsUserView>
                                                                            <RelationshipName />
                                                                            <TargetEntityType>opportunity</TargetEntityType>
                                                                            <AutoExpand>Fixed</AutoExpand>
                                                                            <EnableQuickFind>false</EnableQuickFind>
                                                                            <EnableViewPicker>false</EnableViewPicker>
                                                                            <EnableJumpBar>false</EnableJumpBar>
                                                                            <ChartGridMode>Grid</ChartGridMode>
                                                                            <VisualizationId>{2}</VisualizationId>
                                                                            <EnableChartPicker>false</EnableChartPicker>
                                                                            <RecordsPerPage>10</RecordsPerPage>
                                                                        </parameters>
                                                                    </control>
                                                                </cell>
                                                            </row>
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                            <row />
                                                        </rows>
                                                    </section>
                                                </sections>
                                            </column>
                                        </columns>
                                    </tab>
                                </tabs>
                            </form>",
                languageCode,
                defaultOpportunityQuery.SavedQueryId.Value.ToString("B"),
                visualization.SavedQueryVisualizationId.Value.ToString("B"))                
            };
            _userDashboardId = _serviceProxy.Create(dashboard);

            Console.WriteLine("Created {0}.", dashboard.Name);

            // Create another user to whom the dashboard will be assigned.
            _otherUserId = SystemUserProvider.RetrieveSalesManager(_serviceProxy);            
        }
Ejemplo n.º 33
0
        private void AddUserButton_Click(object sender, EventArgs e)
        {
            var userForm = new UserForm(FormMode.AddNew, OnUserFormClosed);

            userForm.Show();
        }
Ejemplo n.º 34
0
        public ActionResult Form(UserForm model)
        {
            model.IsNew = model.Id == 0;
            var user = new User();

            if (model.Roles.Count(x => x.Checked) == 0)
            {
                ModelState.AddModelError("Roles", "يجب ان تختار صلاحية واحدة على الأقل");
            }

            if (model.IsNew)
            {
                user = new User
                {
                    Name        = model.Name,
                    CreatedBy   = User.Identity.Name,
                    CreatedTime = DateTime.UtcNow.AddHours(2)
                };
                user.Passwordhash = user.SetPassword(model.Password);
                foreach (var role in model.Roles)
                {
                    if (role.Checked)
                    {
                        user.Roles.Add(_db.Roles.Find(role.Id));
                    }
                }
                _db.Users.Add(user);
            }
            else
            {
                user = _db.Users.Find(model.Id);
                if (user == null)
                {
                    return(HttpNotFound());
                }
                user.Name = model.Name;

                user.ModifiedTime = DateTime.UtcNow.AddHours(2);
                var allRoles = _db.Roles.ToList();
                //added roles
                foreach (var role in model.Roles.Where(x => x.Checked))
                {
                    //if user role dosent have one or more checked role add role
                    if (user.Roles.Any(x => x.Id != role.Id))
                    {
                        user.Roles.Add(allRoles.SingleOrDefault(x => x.Id == role.Id));
                    }
                }

                foreach (var role in model.Roles.Where(x => !x.Checked))
                {
                    //if user role dosent have one or more checked role add role
                    if (user.Roles.Any(x => x.Id == role.Id))
                    {
                        user.Roles.Remove(allRoles.SingleOrDefault(x => x.Id == role.Id));
                    }
                }
                ModelState.Remove("password");
            }
            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            try
            {
                _db.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }


            return(RedirectToAction("Index"));
        }
Ejemplo n.º 35
0
 public FormConsole(UserForm userForm)
 {
     form    = userForm;
     logFile = File.CreateText(Path.Combine(Directory.GetParent(Program.GetExecutablePath()).FullName, "CaptureLog.txt"));
 }
Ejemplo n.º 36
0
		public BLResponse<User> Post(UserForm request){
			return Controller.SendUserForm(request, BLRequest);
		}
Ejemplo n.º 37
0
 public void Insert(UserForm userForm)
 {
     UserDao.Insert(userForm);
 }
Ejemplo n.º 38
0
        private void SetLoLForm(UserForm userForm, IntPtr HWND)
        {
            if (!UrlManage.lolBlock)
            {
                if (HWND == IntPtr.Zero)
                {
                    userForm.isOpen = false;
                    userForm.Hide();
                }
                else
                {
                    Win32Native.RECT lpRect = new Win32Native.RECT();
                    Win32Native.GetWindowRect(HWND, ref lpRect);
                    switch ((lpRect.Right - lpRect.Left))
                    {
                    case 0x400:
                        if ((ComHelp.GetPixelColor(userForm.hideLocation1, HWND).ToString() != userForm.hideColor1) && (userForm.hideColor1 != "0"))
                        {
                            if (!userForm.isOpen)
                            {
                                break;
                            }
                            userForm.isOpen = false;
                            userForm.Hide();
                            return;
                        }
                        Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location1.X, userForm.location1.Y, userForm.size1.Width, userForm.size1.Height, 0);
                        Win32Native.SetParent(userForm.Handle, HWND);
                        userForm.isOpen = true;
                        userForm.Show();
                        return;

                    case 0x500:
                        ComHelp.GetPixelColor(userForm.hideLocation2, HWND).ToString();
                        if (ComHelp.GetPixelColor(userForm.hideLocation2, HWND).ToString() == userForm.hideColor2)
                        {
                            if (!userForm.isOpen)
                            {
                                Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location2.X, userForm.location2.Y, userForm.size2.Width, userForm.size2.Height, 0);
                                Win32Native.SetParent(userForm.Handle, HWND);
                                userForm.isOpen = true;
                                userForm.Show();
                                return;
                            }
                            break;
                        }
                        if (!userForm.isOpen)
                        {
                            break;
                        }
                        userForm.isOpen = false;
                        userForm.Hide();
                        return;

                    case 0x640:
                        if (ComHelp.GetPixelColor(userForm.hideLocation3, HWND).ToString() == userForm.hideColor3)
                        {
                            Win32Native.SetWindowPos(userForm.Handle, 0, userForm.location3.X, userForm.location3.Y, userForm.size3.Width, userForm.size3.Height, 0);
                            Win32Native.SetParent(userForm.Handle, HWND);
                            userForm.isOpen = true;
                            userForm.Show();
                            return;
                        }
                        if (!userForm.isOpen)
                        {
                            break;
                        }
                        userForm.isOpen = false;
                        userForm.Hide();
                        return;

                    default:
                        userForm.isOpen = false;
                        userForm.Hide();
                        break;
                    }
                }
            }
        }
Ejemplo n.º 39
0
 public static void RegisterTicket(string address, ushort port, uint instance, UserForm window)
 {
     TicketsManager.Tickets.Add(new TicketEntry(address, port, instance, window));
 }
Ejemplo n.º 40
0
        private async void Save()
        {
            if (string.IsNullOrEmpty(FirstName))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su nombre.");

                return;
            }
            if (string.IsNullOrEmpty(LastName))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su apellido paterno.");

                return;
            }
            if (string.IsNullOrEmpty(MotherLastName))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su apellido materno.");

                return;
            }
            if (string.IsNullOrEmpty(Phone))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su número de teléfono.");

                return;
            }
            var digito = Phone.Substring(0, 1);

            if (Convert.ToInt32(digito) != 9)
            {
                await dialogService.ShowMessage("Mensaje", "Debe empezar el primero dígito del número telefónico con el número 9");

                return;
            }
            if (string.IsNullOrEmpty(DNI))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su número de DNI.");

                return;
            }
            if (string.IsNullOrEmpty(Email))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar su email.");

                return;
            }
            if (!Utilities.IsValidEmail(Email))
            {
                await dialogService.ShowMessage("Mensaje", "Debe ingresar un Email  válido");

                return;
            }
            if (string.IsNullOrEmpty(Password))
            {
                await dialogService.ShowMessage("Mensaje", "Debes ingresar una Contraseña");

                return;
            }

            int numberCharter = Password.Length;

            if (numberCharter < 5)
            {
                await dialogService.ShowMessage("Mensaje", "Su contarseña debe tener como mínimo 5 caracteres.");

                return;
            }

            if (string.IsNullOrEmpty(PasswordConfirm))
            {
                await dialogService.ShowMessage("Mensaje", "Debes ingresar la confirmación de la contraseña");

                return;
            }
            if (!PasswordConfirm.Equals(Password))
            {
                await dialogService.ShowMessage("Mensaje", "Las contraseñas no coinciden");

                return;
            }

            if (UserTypeId == 0)
            {
                await dialogService.ShowMessage("Mensaje", "Seleccione un tipo de usuario");

                return;
            }

            isBusy    = true;
            IsEnabled = !isBusy;

            byte[] array = null;
            if (ImageSource != null)
            {
                Stream stream = null;
                if (file != null)
                {
                    stream = file.GetStream() ?? null;
                    if (stream != null)
                    {
                        array = Utilities.ReadFully(stream);
                    }
                }
            }

            var userForm = new UserForm
            {
                Nombre           = FirstName,
                Apellido_Paterno = LastName,
                Apellido_Materno = MotherLastName,
                Telefono         = Phone,
                DNI              = DNI,
                Email            = Email,
                Contrasenia      = Password,
                Fecha_Nacimiento = DateTime.UtcNow.AddHours(-5),
                //Photo
                //Usuario_Name=Email,
                UserTypeId = UserTypeId,
            };

            var isReachable = await CrossConnectivity.Current.IsRemoteReachable("google.com");

            if (isReachable)
            {
                var response = await apiService.Post <UserForm, Response>(Configuration.SERVER, "/api", "/account/RegisterUser", "", "", userForm, false);

                if (response != null)
                {
                    var result = (Response)response.Resullt;
                    isBusy    = false;
                    IsEnabled = !isBusy;

                    if (result.IsSuccess)
                    {
                        await dialogService.ShowMessage("Confirmación", result.Message);

                        navigationService.SetMainPage("NewLoginPage");
                    }
                    else
                    {
                        await dialogService.ShowMessage("Mensaje", result.Message);

                        return;
                    }
                }
            }
            else
            {
                isBusy    = false;
                IsEnabled = !isBusy;
                await dialogService.ShowMessage("Mensaje", "Es necesario tener conexión a internet para poder registrarse");

                return;
            }
        }
Ejemplo n.º 41
0
		public BLResponse<User> Get(UserForm request){
			return Post(request);
		}
 public UserSearchPresenter(IUserSearchView view, UserSearchModel model, UserForm.IUserView viewUserForm)
 {
     this.view = view;
     this.model = model;
     this.viewUserForm = viewUserForm;
 }
Ejemplo n.º 43
0
        private void ensureUserFromExists()
        {
            if (m_UserForm != null)
            {
                return;
            }

            m_UserForm = new UserForm();
            m_UserForm.FormClosed += (sender, e) => m_UserForm = null;
        }
 ///// <exception cref="ArgumentNullException">form == null. -или- ip == null. -или- resultOfOperation == null.</exception>
 ///// <exception cref="ArgumentOutOfRangeException">Строка не является ip адресом.</exception>
 //public abstract bool RegisterNewUser(UserForm form, IPAddress ip, ResultOfOperation resultOfOperation);
 /// <exception cref="ArgumentNullException">form == null. -или- ip == null. -или- resultOfOperation == null.</exception>
 /// <exception cref="ArgumentOutOfRangeException">Строка не является ip адресом.</exception>
 public abstract Task <bool> RegisterNewUserAsync(UserForm form, IPAddress ip,
                                                  ResultOfOperation resultOfOperation);