Exemple #1
0
        private void Button_Aplicar(object sender, RoutedEventArgs e)
        {
            int          result       = 0;
            bool         ValidateCode = false;
            TrainerModel _trainer     = new TrainerModel();

            _trainer.Code        = TxtCodigo.Text.Trim();
            _trainer.Name        = TxtName.Text.Trim();
            _trainer.Description = TxtDescription.Text.Trim();
            _trainer.Type        = int.Parse(CmbType.SelectedValue.ToString());
            _trainer.Active      = CmbActive.Text == "Activo";
            _trainer.Huella1     = _huella1;
            _trainer.Huella2     = _huella2;
            if (String.IsNullOrEmpty(TxtCosto.Text.Trim()))
            {
                _trainer.Price = 0;
            }
            else
            {
                _trainer.Price = Double.Parse(TxtCosto.Text.Trim());
            }

            _trainer.PhotoLink = _photoLink == string.Empty? null: _photoLink;


            if ((!string.IsNullOrEmpty(TxtName.Text.Trim())) || (!string.IsNullOrEmpty(TxtCodigo.Text.Trim())))
            {
                if (LblId.Content == "0") //ADD
                {
                    var existCode = trainerServices.GetByCode(TxtCodigo.Text.Trim());
                    if (existCode == null)
                    {
                        result = trainerServices.Add(_trainer);
                        //result = task0.Result;
                        LblId.Content = result.ToString();
                    }
                    else
                    {
                        ValidateCode = true;
                        GRDialogInformation _error01 = new GRDialogInformation();
                        _error01.Message = "El codigo ingresado pertenece a otro registro";
                        _error01.ShowDialog();
                        TxtCodigo.Focus();
                    }
                }
                else //EDIT
                {
                    int _id = int.Parse(LblId.Content.ToString());
                    _trainer.Id = _id;
                    var task = trainerServices.Update(_trainer);
                    result = task ? _id : 0;
                }

                if (result > 0)
                {
                    GRDialogConsultation _var = new GRDialogConsultation();
                    _var.Message = "Registro Guardado, desea crear otro Registro?";
                    if (_var.ShowDialog() == true)
                    {
                        CleanControls();
                        TxtName.Focus();
                    }
                    else
                    {
                        var window = new TrainerList();
                        this.Close();
                        window.ShowDialog();
                    }
                }
                else
                {
                    if (!ValidateCode)
                    {
                        GRDialogError _error = new GRDialogError();
                        _error.Message = "Error";
                        _error.ShowDialog();
                    }
                }
            }
            else
            {
                GRDialogError _error = new GRDialogError();
                _error.Message = "Verificar campos obligatorios";
                _error.ShowDialog();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     TxtName.Focus();
 }
        void ReleaseDesignerOutlets()
        {
            if (BtnChangeCertificate != null)
            {
                BtnChangeCertificate.Dispose();
                BtnChangeCertificate = null;
            }

            if (BtnSave != null)
            {
                BtnSave.Dispose();
                BtnSave = null;
            }

            if (BtnViewCertificate != null)
            {
                BtnViewCertificate.Dispose();
                BtnViewCertificate = null;
            }

            if (cbDisabled != null)
            {
                cbDisabled.Dispose();
                cbDisabled = null;
            }

            if (TxtDescription != null)
            {
                TxtDescription.Dispose();
                TxtDescription = null;
            }

            if (TxtDn != null)
            {
                TxtDn.Dispose();
                TxtDn = null;
            }

            if (TxtName != null)
            {
                TxtName.Dispose();
                TxtName = null;
            }

            if (TxtValidFrom != null)
            {
                TxtValidFrom.Dispose();
                TxtValidFrom = null;
            }

            if (TxtValidTo != null)
            {
                TxtValidTo.Dispose();
                TxtValidTo = null;
            }

            if (TxtIssuer != null)
            {
                TxtIssuer.Dispose();
                TxtIssuer = null;
            }
        }
Exemple #4
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            //    try
            //    {
            if (TxtInitial.Text == "")
            {
                MessageBox.Show("Company Initial is not Blank..!!", "Mr. Solution");
                TxtInitial.Focus();
                return;
            }
            if (TxtName.Text == "")
            {
                MessageBox.Show("Company Name is not Blank..!!", "Mr. Solution");
                TxtName.Focus();
                return;
            }

            //_objCompany.Model.DatabaseName = "ERP" + Convert.ToString((Regex.Replace(TxtInitial.Text.Trim(), @"[^0-9a-zA-Z]+", "").Length >= 4) ? ((Regex.Replace(TxtInitial.Text.Trim(), @"[^0-9a-zA-Z]+", "")).Substring(0, 4)).ToUpper() : Regex.Replace(TxtInitial.Text.Trim().ToUpper(), @"[^0-9a-zA-Z]+", "").PadLeft(4, '0'));
            //_objCompany.Model.DatabaseName = _objCompany.Model.DatabaseName.Trim().PadRight(7, '0') + "01";
            //Query = "SELECT * FROM CompanyMaster Where Initial ='" + _objCompany.Model.DatabaseName.Substring(0, 7) + "' ";
            //DataTable dt = DataAccessLayer.Database.FetchingMasterData(Query);
            //if (dt.Rows.Count > 0)
            //{
            //    _objCompany.Model.DatabaseName = _objCompany.Model.DatabaseName.Substring(0, 7) + (dt.Rows.Count + 1).ToString().PadLeft(2, '0');
            //}

            _objCompany.Model.DatabaseName = "ERP" + TxtInitial.Text.Trim() + "01";
            string DrivePath = CmbDataDrive.SelectedItem.ToString() + "ERP\\";

            if (!Directory.Exists(DrivePath))
            {
                DirectoryInfo di = Directory.CreateDirectory(DrivePath);
            }
            _objCompany.Model.DatabasePath = DrivePath;
            string BackupPath = CmbBackupDrive.SelectedItem.ToString() + "ERP\\";

            if (!Directory.Exists(BackupPath))
            {
                DirectoryInfo di = Directory.CreateDirectory(BackupPath);
            }
            _objCompany.Model.DataBackupPath = BackupPath;

            _objCompany.Model.Tag       = _Tag;
            _objCompany.Model.CompanyId = _CompanyId;
            _objCompany.Model.Initial   = _Initial;
            if ((_Tag == "EDIT" || _Tag == "DELETE") && _Initial == "")
            {
                ClearFld();
                TxtInitial.Focus();
                return;
            }
            _objCompany.Model.CompanyLogo = null; //ClsGlobal.ReadFile(pb_CompanyLogo.ImageLocation);
            _objCompany.Model.Initial     = TxtInitial.Text.Trim();
            _objCompany.Model.CompanyName = TxtName.Text.Trim();
            _objCompany.Model.StartDate   = Convert.ToDateTime(TxtStartDate.Text);
            _objCompany.Model.EndDate     = Convert.ToDateTime(TxtEndDate.Text);
            _objCompany.Model.FiscalYear  = TxtFiscalYear.Text.Trim();
            _objCompany.Model.Address     = TxtAddress.Text.Trim();
            _objCompany.Model.District    = TxtDistrict.Text.Trim();
            _objCompany.Model.City        = TxtCity.Text.Trim();
            _objCompany.Model.State       = TxtState.Text.Trim();
            _objCompany.Model.Country     = TxtCountry.Text.Trim();
            _objCompany.Model.PhoneNo     = TxtPhoneNo.Text.Trim();
            _objCompany.Model.Fax         = TxtFax.Text.Trim();
            _objCompany.Model.Email       = TxtEmail.Text.Trim();
            _objCompany.Model.Website     = TxtWebSite.Text.Trim();
            _objCompany.Model.PanNo       = TxtPanNo.Text.Trim();
            _objCompany.Model.VersionNo   = 0;
            _objCompany.Model.AltPhoneNo  = "";
            _objCompany.Model.DefaultData = chkDefaultData.Checked == true ? true : false;
            _objCompany.Model.EnterBy     = ClsGlobal.LoginUserCode;
            _objCompany.Model.Status      = true; //CbActive.Checked == true ? true : false;
            string result = _objCompany.SaveCompany();

            //_objCompany.RestoreDatabase();
            if (!string.IsNullOrEmpty(result))
            {
                MessageBox.Show("Data Submit Successfully", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearFld();
                TxtInitial.Focus();
            }
            else
            {
                MessageBox.Show("Error occured during data submit", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.ToString(), "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //}
        }
 /// <summary>Initializes a new instance of NewSeriesPage.</summary>
 public NewSeriesPage()
 {
     InitializeComponent();
     TxtName.Focus();
 }
Exemple #6
0
 private void FrmDodge_Load(object sender, EventArgs e)
 {
     MessageBox.Show("Use the left and right arrow keys to move the spaceship. \n Don't get hit by the planets! \n Every planet that goes past scores a point. \n If a planet hits a spaceship a life is lost!", "Game Instructions");
     TxtName.Focus();
     MnuStart.Enabled = false;
 }
Exemple #7
0
        private void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if ((TxtName.Text == "") || (TxtEmail.Text == ""))
                {
                    if (TxtName.Text == "")
                    {
                        MessageBox.Show("Name is requiered", "Caution", MessageBoxButton.OK);
                        TxtName.Focus();
                    }
                    else if (TxtEmail.Text == "")
                    {
                        MessageBox.Show("Email is required", "Caution", MessageBoxButton.OK);
                        TxtEmail.Focus();
                    }
                }
                else
                {
                    var email = myContext.Suppliers.Where(p => p.Email == TxtEmail.Text).FirstOrDefault();
                    //foreach (var email in myContext.Suppliers)
                    //{
                    //    if (email.Email == TxtEmail.Text)
                    //    {
                    //        validEmail = false;
                    //    }
                    //}
                    if (email == null)
                    {
                        string message = "Halo this message has been sent from wpf";
                        var    push    = new Supplier(TxtName.Text, TxtEmail.Text);
                        myContext.Suppliers.Add(push);
                        var result = myContext.SaveChanges();
                        if (result > 0)
                        {
                            MessageBox.Show(result + " row has been inserted");
                        }


                        Outlook._Application _app = new Outlook.Application();
                        Outlook.MailItem     mail = (Outlook.MailItem)_app.CreateItem(Outlook.OlItemType.olMailItem);
                        mail.Subject    = TxtName.Text;
                        mail.To         = TxtEmail.Text;
                        mail.Body       = message;
                        mail.Importance = Outlook.OlImportance.olImportanceNormal;
                        ((Outlook._MailItem)mail).Send();
                        MessageBox.Show("Your Message has been succesfully sent.", "Message", MessageBoxButton.OK);
                    }

                    else
                    {
                        MessageBox.Show("Email has been used");
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK);
            }

            DataGridSupplier.ItemsSource = myContext.Suppliers.ToList();
            TxtName.Text  = "";
            TxtEmail.Text = "";
        }
        void ReleaseDesignerOutlets()
        {
            if (BtnChangeCertificate != null)
            {
                BtnChangeCertificate.Dispose();
                BtnChangeCertificate = null;
            }

            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }

            if (BtnSave != null)
            {
                BtnSave.Dispose();
                BtnSave = null;
            }

            if (CbDisabled != null)
            {
                CbDisabled.Dispose();
                CbDisabled = null;
            }

            if (ImageView != null)
            {
                ImageView.Dispose();
                ImageView = null;
            }

            if (TxtDescription != null)
            {
                TxtDescription.Dispose();
                TxtDescription = null;
            }

            if (TxtName != null)
            {
                TxtName.Dispose();
                TxtName = null;
            }

            if (TxtIssuer != null)
            {
                TxtIssuer.Dispose();
                TxtIssuer = null;
            }

            if (TxtValidFrom != null)
            {
                TxtValidFrom.Dispose();
                TxtValidFrom = null;
            }

            if (TxtValidTo != null)
            {
                TxtValidTo.Dispose();
                TxtValidTo = null;
            }

            if (TxtDC != null)
            {
                TxtDC.Dispose();
                TxtDC = null;
            }
        }
Exemple #9
0
        public NewModule()
        {
            InitializeComponent();

            TxtName.Focus();
        }
Exemple #10
0
 private void BtnAddNew_OnClick(object sender, RoutedEventArgs e)
 {
     TxtName.Focus();
 }
Exemple #11
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     TxtName.Focus();
 }
Exemple #12
0
        /// <summary>
        /// 添加用户
        /// </summary>
        private void AddUser()
        {
            addUserArgs.UserNo = TxtUserNo.Text;
            if (TxtUserNo.Text != "" && TxtUserNo.Text.Length <= 20)
            {
                this.OnLeave(null, addUserArgs);
                if (isUserNoRepeat)
                {
                    this.OnLeave(null, addUserArgs);
                    CJia.PIVAS.Tools.Message.Show("此工号已存在");
                    TxtUserNo.Focus();
                    TxtUserNo.SelectAll();
                    isUserNoRepeat = false;
                    return;
                }
            }
            else
            {
                CJia.PIVAS.Tools.Message.Show("工号不能为空且不能长于20位");
                TxtUserNo.Focus();
                TxtUserNo.SelectAll();
                return;
            }

            if (TxtName.Text != "" && TxtName.Text.Length < 20)
            {
                addUserArgs.UserName = TxtName.Text;
            }
            else
            {
                CJia.PIVAS.Tools.Message.Show("请填写用户名称,并且长度不能大于20位");
                TxtName.Focus();
                TxtName.SelectAll();
                return;
            }
            if (TxtNewPwd.Text != "" && TxtNewPwd.Text.Length <= 6)
            {
                if (TxtSurePwd.Text != "" && TxtSurePwd.Text.Length <= 6)
                {
                    if (TxtNewPwd.Text == TxtSurePwd.Text)
                    {
                        addUserArgs.Pwd      = CJia.PIVAS.Common.EncryptString(TxtNewPwd.Text);
                        addUserArgs.UserId   = User.UserId;
                        addUserArgs.DeptId   = "1000000000";
                        addUserArgs.DeptName = "静脉药物配置中心";
                        this.OnaddUser(null, addUserArgs);
                    }
                    else
                    {
                        CJia.PIVAS.Tools.Message.Show("密码必须一致!");
                        TxtNewPwd.Focus();
                        TxtNewPwd.SelectAll();
                        return;
                    }
                }
                else
                {
                    CJia.PIVAS.Tools.Message.Show("请填写确认密码,并且长度不能大于6位");
                    TxtSurePwd.Focus();
                    TxtSurePwd.SelectAll();
                    return;
                }
            }
            else
            {
                CJia.PIVAS.Tools.Message.Show("请填写密码,并且长度不能大于6位");
                TxtNewPwd.Focus();
                TxtNewPwd.SelectAll();
                return;
            }
        }
Exemple #13
0
        private void FxCancel()
        {
            ImgLogo.Image = null;

            lFileLogo = "";

            TxtName.Text        = "";
            TxtDescription.Text = "";
            TxtExecutable.Text  = "";

            ChkEnabled.Checked = false;

            TxtName.Enabled        = false;
            TxtDescription.Enabled = false;
            TxtExecutable.Enabled  = false;

            ChkEnabled.Enabled = false;

            CmdLogo.Enabled = true;
            CmdSave.Enabled = false;

            if (lModuleId == 0)
            {
                Text += " - Adicionar";

                TxtName.Enabled        = true;
                TxtDescription.Enabled = true;
                TxtExecutable.Enabled  = true;

                ChkEnabled.Checked = true;

                CmdSave.Enabled = true;

                TxtName.Focus();
            }
            else
            {
                Text += " - Modificar";

                DataTable ObjDt = ClsSqlAdministrator.Fx_sel_tblModule_detail(lModuleId);

                if (ObjDt != null)
                {
                    if (ObjDt.Rows.Count > 0)
                    {
                        TxtName.Text        = ObjDt.Rows[0][0].ToString();
                        TxtDescription.Text = ObjDt.Rows[0][1].ToString();
                        TxtExecutable.Text  = ObjDt.Rows[0][2].ToString();

                        ChkEnabled.Checked = ClsFunctions.FxConvertStringToBool(ObjDt.Rows[0][3].ToString());

                        Bitmap ObjLogo;

                        try
                        {
                            ObjLogo = ClsSqlAdministrator.Fx_sel_tblModuleLogo(lModuleId);
                        }
                        catch
                        {
                            ObjLogo = null;
                        }

                        if (ObjLogo != null)
                        {
                            lFileLogo = ClsVariables.gPathTemp + "Img" + ClsFunctions.FxRandomNumber().ToString() + ".png";

                            if (File.Exists(lFileLogo))
                            {
                                ClsFunctions.FxDeleteFile(lFileLogo);
                            }

                            ObjLogo.Save(lFileLogo);

                            ObjLogo.Dispose();

                            ImgLogo.Image = Bitmap.FromFile(lFileLogo);
                        }

                        TxtName.Enabled        = true;
                        TxtDescription.Enabled = true;
                        TxtExecutable.Enabled  = true;

                        ChkEnabled.Enabled = true;

                        CmdSave.Enabled = true;

                        TxtName.Focus();
                    }
                }
            }
        }
Exemple #14
0
        private void FxSave()
        {
            string lName        = TxtName.Text.Trim();
            string lDescription = TxtDescription.Text.Trim();
            string lExecutable  = TxtExecutable.Text.Trim();

            bool lEnabled = ChkEnabled.Checked;

            if (lName.Length < 3)
            {
                ClsFunctions.FxMessage(1, "Ingrese nombre");

                TxtName.Text = "";

                TxtName.Focus();

                return;
            }

            if (lDescription.Length < 3)
            {
                ClsFunctions.FxMessage(1, "Ingrese descripción");

                TxtDescription.Text = "";

                TxtDescription.Focus();

                return;
            }

            if (lExecutable.Length < 3)
            {
                ClsFunctions.FxMessage(1, "Ingrese ejecutable");

                TxtExecutable.Text = "";

                TxtExecutable.Focus();

                return;
            }

            if (ClsFunctions.FxMessage(2, "¿Está seguro de guardar los cambios?") == true)
            {
                long lModuleId_new;

                if (lModuleId == 0)
                {
                    lModuleId_new = ClsSqlAdministrator.Fx_ins_tblModule(lName, lDescription, lExecutable);
                }
                else
                {
                    lModuleId_new = ClsSqlAdministrator.Fx_upt_tblModule(lModuleId, lName, lDescription, lExecutable, lEnabled);
                }

                if (lModuleId_new > 0)
                {
                    if (lFileLogo.Length > 0)
                    {
                        lModuleId_new = ClsSqlAdministrator.Fx_ins_tblModuleLogo(lModuleId_new, lFileLogo);
                    }

                    ClsFunctions.FxMessage("Proceso concluido");

                    FxExit();
                }
            }
        }