private void comprar_Click(object sender, EventArgs e)
 {
     if (!FormValidate.isUserLoggedIn())
     {
         return;
     }
     if (!ClienteValidaciones.tieneCalificacionesAlDia(Session.usuario.id))
     {
         MessageBox.Show("Tenes mas de 5 compras sin calificar y no podes realizar mas compras/ofertas hasta que califiques las mismas.");
         return;
     }
     if (publicacion.usuario.id != Session.usuario.id)
     {
         Int32 cantidadAComprar = Convert.ToInt32(cantidad.Text);
         if (publicacion.unidades < cantidadAComprar)
         {
             MessageBox.Show("No podes comprar mas de las unidades que hay disponibles.");
             return;
         }
         Publicaciones.comprar(publicacion.id, cantidadAComprar, publicacion.precio);
         Usuario            usuario            = Usuarios.buscarUsuarioPorID(publicacion.usuario.id);
         VerDetalleVendedor verDetalleVendedor = new VerDetalleVendedor(usuario);
         verDetalleVendedor.Show();
         this.Close();
     }
     else
     {
         MessageBox.Show("No podes comprar tus publicaciones");
     }
 }
Esempio n. 2
0
 private void ofertar_Click(object sender, EventArgs e)
 {
     if (!FormValidate.isUserLoggedIn())
     {
         return;
     }
     if (!ClienteValidaciones.tieneCalificacionesAlDia(Session.usuario.id))
     {
         MessageBox.Show("Tenes mas de 5 compras sin calificar y no podes realizar mas compras/ofertas hasta que califiques las mismas.");
         return;
     }
     if (publicacion.usuario.id != Session.usuario.id)
     {
         Int32 oferta = Convert.ToInt32(montoOferta.Text);
         if (publicacion.precio > oferta)
         {
             MessageBox.Show("El monto de oferta debe ser superior al precio actual.");
             return;
         }
         Publicaciones.ofertar(publicacion.id, oferta);
         Usuario usuario = Usuarios.buscarUsuarioPorID(publicacion.usuario.id);
         MessageBox.Show("Hiciste la oferta con exito de $ " + montoOferta.Text);
         precio.Text      = montoOferta.Text;
         montoOferta.Text = "";
     }
     else
     {
         MessageBox.Show("No podes comprar tus publicaciones");
     }
 }
Esempio n. 3
0
        private void accion_Click(object sender, EventArgs e)
        {
            Visibilidad visibilidad = new Visibilidad();

            if (FormValidate.StringIsNullOrEmpty(codigo.Text, "Codigo"))
            {
                visibilidad.id = Convert.ToInt64(codigo.Text);
            }
            if (FormValidate.StringIsNullOrEmpty(descripcion.Text, "Descripcion"))
            {
                visibilidad.descripcion = descripcion.Text;
            }
            if (FormValidate.StringIsNullOrEmpty(precio.Text, "Precio"))
            {
                visibilidad.precio = Convert.ToDouble(precio.Text);
            }
            if (FormValidate.StringIsNullOrEmpty(porcentaje.Text, "Porcentaje"))
            {
                visibilidad.porcentaje = Convert.ToDouble(porcentaje.Text) / 100;
            }

            Visibilidades.crearOModificar(visibilidad);
            MessageBox.Show("Acción realizada con éxito.");
            this.Close();
        }
Esempio n. 4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (tmepmodel == null)
            {
                MessageBox.Show("请选择树节点");
                return;
            }
            bool b = false;

            if (!FormValidate.IsNumber(this.F_ShowWidth.Text.Trim(), false))
            {
                this.F_ShowWidthTip.Text = "(请填写正整数!)";
                b = true;
            }
            if (!FormValidate.IsNumber(this.F_ShowHeight.Text.Trim(), false))
            {
                this.F_ShowHeightTip.Text = "(请填写正整数!)";
                b = true;
            }
            if (!FormValidate.IsNumber(this.F_ShowFontSize.Text.Trim(), false))
            {
                this.F_ShowFontSizeTip.Text = "(请填写正整数!)";
                b = true;
            }
            if (!FormValidate.IsColor(F_ShowBorderColor.Text.Trim()))
            {
                this.F_ShowBorderColorTip.Text = "(颜色格式不正确!)";
                b = true;
            }
            if (!FormValidate.IsColor(F_ShowFontColor.Text.Trim()))
            {
                this.F_ShowFontColorTip.Text = "(颜色格式不正确!)";
                b = true;
            }
            if (!FormValidate.IsColor(F_ShowBackColor.Text.Trim()))
            {
                this.F_ShowBackColorTip.Text = "(颜色格式不正确!)";
                b = true;
            }

            if (b)
            {
                return;
            }



            if (tmepmodel != null)
            {
                tmepmodel.F_ShowWidth       = int.Parse(F_ShowWidth.Text.Trim());
                tmepmodel.F_ShowHeight      = int.Parse(F_ShowHeight.Text.Trim());
                tmepmodel.F_ShowFontSize    = int.Parse(F_ShowFontSize.Text.Trim());
                tmepmodel.F_ShowBorderColor = F_ShowBorderColor.Text;
                tmepmodel.F_ShowFontColor   = F_ShowFontColor.Text;
                tmepmodel.F_ShowBackColor   = F_ShowBackColor.Text;
                SystemManager.Instance.Services.Test_Table_TempleteService.Update(tmepmodel);
                MessageBox.Show("更新成功!");
            }
        }
Esempio n. 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (FormValidate.isUserLoggedIn())
     {
         ListadoDePublicaciones form = new ListadoDePublicaciones();
         form.Show();
     }
 }
Esempio n. 6
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            bool b = false;

            if (string.IsNullOrEmpty(this.txtF_Name.Text.Trim()))
            {
                this.txtF_NameTip.Text = "(必须填写!)";
                b = true;
            }
            if (!FormValidate.IsPlusDecimal(this.txtF_Money.Text.Trim()))
            {
                this.txtF_MoneyTip.Text = "(必须填写[数字]!)";
                b = true;
            }
            if (b)
            {
                return;
            }



            if (m_Model == null)
            {
                Library.Model.Audit model = new Audit();
                model.F_Name       = this.txtF_Name.Text.Trim();
                model.F_Content    = this.txtF_Content.Text.Trim();
                model.F_Money      = decimal.Parse(this.txtF_Money.Text.Trim());
                model.F_Time       = DateTime.Now;
                model.F_UserID     = SystemManager.Instance.CurrentUser.F_UserID;
                model.F_WF_StateID = SystemManager.Instance.Services.WorkFlow_TempleteService.GetNextState(Library.DataDictionary.WorkFlowLinkTable.Audit);
                model.F_Date       = DateTime.Now;
                model.F_IsDelete   = false;
                model.F_Type       = 0;

                Library.Controller.SystemManager.Instance.Services.AuditService.Add(model);
                if (SaveComplete != null)
                {
                    SaveComplete(model);
                }
            }
            else
            {
                m_Model.F_Name    = this.txtF_Name.Text.Trim();
                m_Model.F_Content = this.txtF_Content.Text.Trim();
                m_Model.F_Money   = decimal.Parse(this.txtF_Money.Text.Trim());
                m_Model.F_Time    = DateTime.Now;
                m_Model.F_UserID  = SystemManager.Instance.CurrentUser.F_UserID;
                Library.Controller.SystemManager.Instance.Services.AuditService.Update(m_Model);
                if (SaveComplete != null)
                {
                    SaveComplete(m_Model);
                }
            }


            this.Close();
        }
Esempio n. 7
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            bool b = false;

            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                this.txtNameTip.Text = "(必须填写!)";
                b = true;
            }
            if (!FormValidate.IsNumber(this.txtF_Order.Text.Trim()))
            {
                this.txtF_OrderTip.Text = "排序格式不正确!";
                b = true;
            }
            if (b)
            {
                return;
            }



            if (m_Model == null)
            {
                Library.Model.Equipment model = new Equipment();
                model.F_Name = this.txtName.Text.Trim();
                model.F_Decs = this.txtF_Decs.Text.Trim();
                if (!string.IsNullOrEmpty(this.txtF_Order.Text.Trim()))
                {
                    model.F_Order = int.Parse(this.txtF_Order.Text.Trim());
                }
                Library.Controller.SystemManager.Instance.Services.EquipmentService.Add(model);
                if (SaveComplete != null)
                {
                    SaveComplete(model);
                }
            }
            else
            {
                m_Model.F_Name = this.txtName.Text.Trim();
                m_Model.F_Decs = this.txtF_Decs.Text.Trim();
                if (!string.IsNullOrEmpty(this.txtF_Order.Text.Trim()))
                {
                    m_Model.F_Order = int.Parse(this.txtF_Order.Text.Trim());
                }
                Library.Controller.SystemManager.Instance.Services.EquipmentService.Update(m_Model);
                if (SaveComplete != null)
                {
                    SaveComplete(m_Model);
                }
            }


            this.Close();
        }
 private void preguntar_button_Click(object sender, EventArgs e)
 {
     if (FormValidate.isUserLoggedIn())
     {
         Publicacion publicacion = (Publicacion)listadoPublicaciones.CurrentRow.DataBoundItem;
         if (Session.usuario.id != publicacion.usuario.id)
         {
             CuadroPreguntar cuadroPreguntar = new CuadroPreguntar(publicacion.id);
         }
         else
         {
             MessageBox.Show("No se pueden hacer preguntas a tus propias publicaciones.");
         }
     }
 }
Esempio n. 9
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            bool b = false;

            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                this.txtNameTip.Text = "(必须填写!)";
                b = true;
            }
            if (!FormValidate.IsPhone(this.txtMobile.Text.Trim()))
            {
                this.txtMobileTip.Text = "(手机号格式不正确!)";
                b = true;
            }
            if (b)
            {
                return;
            }



            if (m_Model == null)
            {
                Library.Model.Employee model = new Employee();
                model.F_Name   = this.txtName.Text.Trim();
                model.F_Mobile = this.txtMobile.Text.Trim();
                Library.Controller.SystemManager.Instance.Services.EmployeeService.Add(model);
                if (SaveComplete != null)
                {
                    SaveComplete(model);
                }
            }
            else
            {
                m_Model.F_Name   = this.txtName.Text.Trim();
                m_Model.F_Mobile = this.txtMobile.Text.Trim();
                Library.Controller.SystemManager.Instance.Services.EmployeeService.Update(m_Model);
                if (SaveComplete != null)
                {
                    SaveComplete(m_Model);
                }
            }


            this.Close();
        }
Esempio n. 10
0
        private void saveEmployee_Click(object sender, EventArgs e)
        {
            try
            {
                var valid = new FormValidate().IsValidControls(new List <ControlToValidate>
                {
                    new ControlToValidate {
                        Control = lastName, ValidateType = ValidationType.Required
                    },
                    new ControlToValidate {
                        Control = otherNames, ValidateType = ValidationType.Required
                    },
                    new ControlToValidate {
                        Control = jobTitle, ValidateType = ValidationType.Required
                    },
                    new ControlToValidate {
                        Control = phoneNumber, ValidateType = ValidationType.Required
                    }
                });

                if (!valid)
                {
                    return;
                }
                var employee = new Employee
                {
                    LastName    = lastName.Text,
                    OtherNames  = otherNames.Text,
                    JobTitle    = jobTitle.Text,
                    PhoneNumber = phoneNumber.Text,
                    Email       = email.Text,
                    Address     = address.Text,
                    EmployeeNo  = employeeNumber.Text,
                    Name        = lastName.Text + " " + otherNames.Text,
                    CreatedBy   = "System",
                    ModifiedBy  = "System"
                };
                DbContext.Employees.Save(employee, _index);
                Success("Employee Saved.");
                backButton_Click(sender, e);
            }
            catch (Exception ex)
            {
                Error(ex.Message);
            }
        }
 public PreguntasRealizadas()
 {
     if (FormValidate.isUserLoggedIn())
     {
         List <Pregunta> preguntas = Preguntas.buscarPorIdUsuario(Session.usuario.id);
         if (preguntas.Count() == 0)
         {
             MessageBox.Show("No hay preguntas realizadas");
             this.Close();
         }
         else
         {
             InitializeComponent();
             listadoPreguntas.DataSource = preguntas;
             this.Show();
         }
     }
 }
Esempio n. 12
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!FormValidate.StringIsNullOrEmpty(username.Text, "username"))
            {
                return;
            }
            if (Usuarios.buscarUsuarioPorUsername(username.Text) != null)
            {
                MessageBox.Show("Existe un usuario con el username: "******"Error de validación.");
                return;
            }

            String contrasenia = Utiles.Password.encriptarPassword("passwordNuevoACambiar");
            RegistroPasoDosCliente siguienteVentana = new RegistroPasoDosCliente(username.Text, contrasenia);

            siguienteVentana.Show();
            this.Close();
        }
Esempio n. 13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (password1.Text != password2.Text)
            {
                MessageBox.Show("El password y el re-password deben ser iguales.", "Error de validación.");
                return;
            }

            if (!FormValidate.StringIsNullOrEmpty(password1.Text, "password") || !FormValidate.StringIsNullOrEmpty(password2.Text, "re-password"))
            {
                return;
            }

            String contrasenia = Utiles.Password.encriptarPassword(password1.Text);

            Usuarios.cambiarPassword(idUsuario, contrasenia);
            MessageBox.Show("Cambiaste el password con éxito", "Ok");
            this.Close();
        }
Esempio n. 14
0
        private void aceptar_Click(object sender, EventArgs e)
        {
            if (FormValidate.StringIsNullOrEmpty(usuario.Text, "username") &&
                FormValidate.StringIsNullOrEmpty(contrasenia.Text, "password"))
            {
                int logeo = Usuarios.logearse(usuario.Text, contrasenia.Text);

                switch (logeo)
                {
                case 0:
                    Session.usuario = Usuarios.buscarUsuarioPorUsername(usuario.Text);
                    Menu menu = new Menu(this);
                    menu.Show();

                    /** Si el usuario ingresa por primera vez, se asume que tiene esa password **/
                    String contraseniaNuevoUsuario          = Utiles.Password.encriptarPassword("passwordNuevoACambiar");
                    String contraseniaNuevoUsuarioIngresada = Utiles.Password.encriptarPassword(contrasenia.Text);
                    if (contraseniaNuevoUsuarioIngresada == contraseniaNuevoUsuario)
                    {
                        CambiarPassword formCambiar = new CambiarPassword(Session.usuario.id);
                        formCambiar.Show();
                    }

                    usuario.Text     = "";
                    contrasenia.Text = "";
                    this.Hide();
                    break;

                case 1:
                    MessageBox.Show("Contraseña incorrecta.", "Error");
                    break;

                case 2:
                    MessageBox.Show("Usuario inexistente.", "Error");
                    break;

                case 3:
                    MessageBox.Show("Usuario alcanzo el límite de intentos.", "Error");
                    break;
                }
            }
        }
Esempio n. 15
0
        private Boolean validateEmptyFields()
        {
            if (!FormValidate.StringIsNullOrEmpty(username.Text, "username"))
            {
                return(false);
            }
            if (!FormValidate.StringIsNullOrEmpty(password1.Text, "password"))
            {
                return(false);
            }
            if (!FormValidate.StringIsNullOrEmpty(password2.Text, "re-password"))
            {
                return(false);
            }
            if (!FormValidate.StringIsNullOrEmpty(rol.SelectedItem.ToString(), "rol"))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 16
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            List <Library.Model.Test_Table> tables = SystemManager.Instance.Services.Test_TableService.GetModelList("F_IsShow=1");

            if (tables.Count == 0)
            {
                MessageBox.Show("请在实验数据管理中,设置要显示的数据!");
                return;
            }

            if (!FormValidate.IsNumber(this.txtTime.Text.Trim(), false))
            {
                MessageBox.Show("请填写正整数!");
                return;
            }


            ShowScreen win = new ShowScreen();

            win.LoadData(tables, double.Parse(this.txtTime.Text));
            win.Show();
        }
Esempio n. 17
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var addTaskModelResult = FormValidate.Validate <AddTaskModel>(this);

            if (!addTaskModelResult.Success)
            {
                MessageBox.Show(this, addTaskModelResult.Message);
                return;
            }
            var addTaskModel = addTaskModelResult.Model;

            if (radInterval.Checked)
            {
                addTaskModel.RunType = (int)RunType.Interval;
            }
            else
            {
                addTaskModel.RunType = (int)RunType.Timing;
            }
            addTaskModel.Hour   = dateTimePicker1.Value.Hour;
            addTaskModel.Minute = dateTimePicker1.Value.Minute;
            if (!File.Exists(addTaskModel.Dll))
            {
                MessageBox.Show(this, "程序集文件不存在");
                return;
            }
            var type = ass.GetTypes().FirstOrDefault(x => x.FullName.EndsWith(addTaskModel.Type));

            if (type == null)
            {
                MessageBox.Show(this, "在选定的文件中未找到指定的类型名称,请确认大小写无误");
                return;
            }
            MethodInfo methodInfo = null;

            try
            {
                methodInfo = type.GetMethod(addTaskModel.Method);
                if (methodInfo == null)
                {
                    MessageBox.Show(this, "在选定的文件中指定的类型中未找到指定的方法,请确认大小写无误、类名无重复,如果类名有重复,请指定全名");
                    return;
                }
            }
            catch (AmbiguousMatchException)
            {
                MessageBox.Show(this, "在选定的文件中指定的类型中未找到指定的方法,请确认大小写无误、类名无重复,如果类名有重复,请指定全名");
                return;
            }
            if (methodInfo.IsStatic)
            {
                MessageBox.Show(this, "指定方法不能为静态方法");
                return;
            }
            if (methodInfo.GetGenericArguments().Length > 0)
            {
                MessageBox.Show(this, "指定方法不能为泛型方法");
                return;
            }
            if (!methodInfo.IsPublic)
            {
                MessageBox.Show(this, "指定方法非公开,请修改为公开");
                return;
            }
            if (methodInfo.GetParameters().Length > 0)
            {
                MessageBox.Show(this, "指定方法不能包含参数");
                return;
            }
            if (db.Tasks.GetList(x => x.Name = addTaskModelResult.Model.Name).Any())
            {
                MessageBox.Show(this, "名称重复");
                return;
            }
            Task = db.Tasks.Create(new Model.Task()
            {
                Dll      = addTaskModel.Dll,
                Hour     = addTaskModel.Hour,
                Interval = addTaskModel.Interval,
                Method   = addTaskModel.Method,
                Minute   = addTaskModel.Minute,
                Name     = addTaskModel.Name,
                RunType  = addTaskModel.RunType,
                Type     = addTaskModel.Type
            });
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 18
0
        private void button1_FormValidation(object sender, RoutedEventArgs e)
        {
            FormValidate formvalidate = new FormValidate();

            formvalidate.Show();
        }
Esempio n. 19
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            bool b = false;

            if (string.IsNullOrEmpty(this.txtF_Name.Text.Trim()))
            {
                this.txtF_NameTip.Text = "(必须填写!)";
                b = true;
            }
            if (string.IsNullOrEmpty(this.txtF_Code.Text.Trim()))
            {
                this.txtF_CodeTip.Text = "(必须填写!)";
                b = true;
            }

            if (!FormValidate.IsNumber(this.txtF_Order.Text.Trim()))
            {
                this.txtF_OrderTip.Text = "(排序格式不正确!)";
                b = true;
            }
            if (b)
            {
                return;
            }

            if (m_Model == null)
            {
                Library.Model.Right model = new Library.Model.Right();
                model.F_Name = this.txtF_Name.Text.Trim();
                model.F_Code = this.txtF_Code.Text.Trim();
                if (this.txtF_PID.SelectedItem != null)
                {
                    NameValue nameValue = this.txtF_PID.SelectedValue as NameValue;
                    model.F_PID = nameValue.IntValue;
                }
                if (!string.IsNullOrEmpty(this.txtF_Order.Text.Trim()))
                {
                    model.F_Order = int.Parse(this.txtF_Order.Text.Trim());
                }

                Library.Controller.SystemManager.Instance.Services.RightService.Add(model);
                if (SaveComplete != null)
                {
                    SaveComplete(model);
                }
            }
            else
            {
                m_Model.F_Name = this.txtF_Name.Text.Trim();
                m_Model.F_Code = this.txtF_Code.Text.Trim();
                if (this.txtF_PID.SelectedItem != null)
                {
                    NameValue nameValue = this.txtF_PID.SelectedValue as NameValue;
                    m_Model.F_PID = nameValue.IntValue;
                }
                if (!string.IsNullOrEmpty(this.txtF_Order.Text.Trim()))
                {
                    m_Model.F_Order = int.Parse(this.txtF_Order.Text.Trim());
                }
                Library.Controller.SystemManager.Instance.Services.RightService.Update(m_Model);
                if (SaveComplete != null)
                {
                    SaveComplete(m_Model);
                }
            }


            this.Close();
        }