예제 #1
0
        public Form1()
        {
            InitializeComponent();

            string url        = @"http://localhost:8080/";
            var    connection = new HubConnection(url);

            _hub = connection.CreateHubProxy("TestHub");
            connection.Start().Wait();

            _hub.On("SendInfo", x => {
                DtoContacto contacto = JsonConvert.DeserializeObject <DtoContacto>(x);

                TxtName.Invoke((MethodInvoker) delegate {
                    // Running on the UI thread
                    TxtName.Text = contacto.Nombre;
                });

                TxtLastName.Invoke((MethodInvoker) delegate {
                    // Running on the UI thread
                    TxtLastName.Text = contacto.Apellido;
                });

                TxtPhone.Invoke((MethodInvoker) delegate {
                    // Running on the UI thread
                    TxtPhone.Text = contacto.Telefono;
                });
            });

            _hub.On("SendNotify", x => {
                MessageBox.Show("Nueva orden");
            });
        }
예제 #2
0
        private void BtnAddUser_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TxtFirstName.Text) && !string.IsNullOrEmpty(TxtLastName.Text) && !string.IsNullOrEmpty(TxtPassword.Text) && (dateEnrollmentDate.Checked || dateHireDate.Checked) && comboBoxDisc.Text != null)
            {
                using (var db = new SchoolEntities())
                {
                    DateTime?dt         = null;
                    var      hireDate   = (dateHireDate.Enabled == true) ? dateHireDate.Value : dt;
                    var      enrollDate = (dateEnrollmentDate.Enabled == true) ? dateEnrollmentDate.Value : dt;

                    var person = new Person()
                    {
                        LastName = TxtLastName.Text, FirstName = TxtFirstName.Text, HireDate = hireDate, EnrollmentDate = enrollDate, Discriminator = comboBoxDisc.SelectedItem.ToString(), Password = TxtPassword.Text
                    };

                    db.Person.Add(person);
                    db.SaveChanges();

                    dataGridView1.DataSource = db.Person.ToList();
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;
                    dataGridView1.FirstDisplayedCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
                }

                TxtFirstName.ResetText();
                TxtLastName.ResetText();
                TxtPassword.ResetText();
                dateHireDate.ResetText();
                dateEnrollmentDate.ResetText();
                comboBoxDisc.SelectedItem = null;
            }
            else
            {
                MessageBox.Show("You havent entered every needed information.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #3
0
 /// <summary>Clears all TextBoxes.</summary>
 private void Clear()
 {
     TxtID.Clear();
     TxtFirstName.Clear();
     TxtLastName.Clear();
     TxtID.Focus();
 }
예제 #4
0
        public void Clear()
        {
            //  clear personal information
            if (PatientSearchVar.ClearType == 0)
            {
                helper.ClearTextBox(TxtLastName);
                helper.ClearTextBox(TxtFirstName);
                helper.ClearTextBox(TxtPatientNum);
                helper.ClearCheckBox(ChkSurgeryDate);
                helper.ClearCheckBox(ChkDOB);
                helper.ClearCheckBox(ChkAge);
                helper.ClearRadioBtn(RdoMale);
                helper.ClearRadioBtn(RdoFemale);
                helper.ClearMaskedTextBox(MTxtssn);

                TxtLastName.Focus();
            }

            //  clear home information
            if (PatientSearchVar.ClearType == 1)
            {
                helper.ClearTextBox(TxtAddress1);
                helper.ClearTextBox(TxtAddress2);
                helper.ClearTextBox(TxtCity);
                helper.ClearComboBoxTxt(CboState);
                helper.ClearMaskedTextBox(MTxtZip);
                helper.ClearMaskedTextBox(MTxtPhone);
                helper.ClearMaskedTextBox(MTxtCell);

                TxtAddress1.Focus();
            }
        }
예제 #5
0
 public CheckoutOverview AddInformation(CheckoutPageBO addInformationCheckoutBO)
 {
     TxtFirstName.SendKeys(addInformationCheckoutBO.FirstName);
     TxtLastName.SendKeys(addInformationCheckoutBO.LastName);
     TxtZipCode.SendKeys(addInformationCheckoutBO.ZipCode);
     BtnContinue.Click();
     return(new CheckoutOverview(driver));
 }
예제 #6
0
 private void BtnClear_Click(object sender, EventArgs e)
 {
     TxtFirstName.Clear();
     TxtLastName.Clear();
     TxtGrade.Clear();
     TxtAddress.Clear();
     TxtContactNo.Clear();
 }
예제 #7
0
 private void BtnClear_Click(object sender, RoutedEventArgs e)
 {
     TxtFirstName.Clear();
     TxtLastName.Clear();
     TxtMiddleName.Clear();
     CmbGender.SelectedItem = null;
     CmbPlayer.SelectedItem = null;
 }
예제 #8
0
        void ReleaseDesignerOutlets()
        {
            if (TxtConfirmPassword != null)
            {
                TxtConfirmPassword.Dispose();
                TxtConfirmPassword = null;
            }

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

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

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

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

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

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

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

            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }
        }
예제 #9
0
 public void Save(string email, string name, string lastname, string phone, string address)
 {
     BtnCreate.Click();
     TxtEmail.EnterText(email);
     TxtFirstName.EnterText(name);
     TxtLastName.EnterText(lastname);
     TxtPhone.EnterText(phone);
     TxtAddress.EnterText(address);
     BtnSave.Click();
 }
예제 #10
0
 private void BtnClear_Click(object sender, RoutedEventArgs e)
 {
     TxtFirstName.Clear();
     TxtLastName.Clear();
     TxtMiddleName.Clear();
     TxtEmail.Clear();
     TxtPhone.Clear();
     DpDateOfBirth.SelectedDate  = null;
     CmbGender.SelectedItem      = null;
     CmbNationality.SelectedItem = null;
 }
예제 #11
0
 private void BtnUpdate_Click(object sender, EventArgs e)
 {
     if (TxtFirstName.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtLastName.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtGrade.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtAddress.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtContactNo.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         var result = MessageBox.Show("Confirm editing new record?", "Edit New Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             using (var con = new MySqlConnection(GetConnection()))
             {
                 string command = $"UPDATE `lms.sad`.`tblusers`" +
                                  $" SET " +
                                  $"`First_Name`='{TxtFirstName.Text}',`Last_Name`='{TxtLastName.Text}',`Year_Level`='{TxtGrade.Text}',`Address`='{TxtAddress.Text}',`Contact_Number`='{TxtContactNo.Text}'" +
                                  $" WHERE `User_ID`='{TxtUserID.Text}'";
                 con.Open();
                 using (var cmd = new MySqlCommand(command, con))
                 {
                     cmd.CommandType = CommandType.Text;
                     var i = cmd.ExecuteNonQuery();
                     if (i > 0)
                     {
                         MessageBox.Show("Successfully Updated! Please refresh Book List to view entry!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         TxtFirstName.Clear();
                         TxtLastName.Clear();
                         TxtGrade.Clear();
                         TxtAddress.Clear();
                         TxtContactNo.Clear();
                         TxtUserID.Clear();
                     }
                 }
                 con.Close();
             }
         }
     }
 }
예제 #12
0
        public ChackoutOverveaw AddInformation(CheckoutPageBO addInformationCheckoutBO)
        {
            TxtFirstName.SendKeys(addInformationCheckoutBO.FirstName);
            TxtLastName.SendKeys(addInformationCheckoutBO.LastName);
            TxtZipCode.SendKeys(addInformationCheckoutBO.ZipCode);



            BtnContinue.Click();
            return(new ChackoutOverveaw(driver));
            //btn_action cart_button - class name pentru butonul de finish
        }
예제 #13
0
        private void ClearData()
        {
            TxtName.Clear();
            TxtLastName.Clear();
            TxtPhone.Clear();

            CbxTipoContacto.SelectedIndex = 0;

            _filename = "";

            PbFotoPerfil.ImageLocation = "";
        }
예제 #14
0
        }     // end method TxtID_Leave()

        /// <summary>
        /// To reset all controls on the add_emp form to their defaults
        /// </summary>
        private void ResetFields()
        {
            //Clear all txtboxes and reset radioBtns to HOURLY
            TxtID.Clear();
            TxtFirstName.Clear();
            TxtLastName.Clear();
            TxtHourlyRate.Clear();
            TxtMonthlySalary.Clear();
            TxtCommissionRate.Clear();
            TxtContractWage.Clear();
            RBtnHourly.Checked = true;
        } // end method ResetFields()
예제 #15
0
 private void BtnRegister_Click(object sender, EventArgs e)
 {
     if (TxtFirstName.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtLastName.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtGrade.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtAddress.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtContactNo.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         var result = MessageBox.Show("Confirm adding new record?", "Add New Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             using (var con = new MySqlConnection(GetConnection()))
             {
                 string command = $"INSERT INTO `lms.sad`.`tblusers` (`First_Name`,`Last_Name`, `Year_Level`, `Address`,`Contact_Number`) " +
                                  "VALUES " +
                                  $"('{TxtFirstName.Text}','{TxtLastName.Text}','{TxtGrade.Text}','{TxtAddress.Text}','{TxtContactNo.Text}')";
                 con.Open();
                 using (var cmd = new MySqlCommand(command, con))
                 {
                     cmd.CommandType = CommandType.Text;
                     var i = cmd.ExecuteNonQuery();
                     if (i > 0)
                     {
                         MessageBox.Show("Successfully Added! Please refresh Borrower List to view entry!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         TxtFirstName.Clear();
                         TxtLastName.Clear();
                         TxtGrade.Clear();
                         TxtAddress.Clear();
                         TxtContactNo.Clear();
                     }
                 }
                 con.Close();
             }
         }
     }
 }
예제 #16
0
        public AddressDetailsPage.AddressDetailsPage AddAddress(AddAddressBO addAddressBo)
        {
            TxtFirstName.SendKeys(addAddressBo.FirstName);
            TxtLastName.SendKeys(addAddressBo.LastName);
            TxtAddress1.SendKeys(addAddressBo.Address1);
            TxtCity.SendKeys(addAddressBo.City);
            var selectState = new SelectElement(DdlState);

            selectState.SelectByText(addAddressBo.State);
            TxtZipCode.SendKeys(addAddressBo.ZipCode);
            LstCountry[addAddressBo.Country].Click();

            var js = (IJavaScriptExecutor)driver;

            js.ExecuteScript("arguments[0].setAttribute('value', arguments[1])", BtnColor, addAddressBo.Color);

            BtnCreateAddress.Click();
            return(new AddressDetailsPage.AddressDetailsPage(driver));
        }
예제 #17
0
 /// <summary>
 /// actually clears each textbox in the form
 /// </summary>
 private void ClearNewEmpForm()
 {
     EpForm.Clear();
     TxtID.Clear();
     TxtFirstName.Clear();
     TxtLastName.Clear();
     TxtAddress.Clear();
     TxtCity.Clear();
     CBxState.SelectedIndex = -1;
     CBxEmpType.SelectedIndex = -1;
     TxtZip.Clear();
     TxtHireDate.Clear();
     CBxMarriageStatus.SelectedIndex = -1;
     TxtDept.Clear();
     TxtJobTitle.Clear();
     LblAfterSubmitMsg.Text = "";
     TxtPayAmount.Visible = false;
     LblPayAmount.Visible = false;
     LblSecondInput.Visible = false;
     TxtSecondInput.Visible = false;
 }
예제 #18
0
        /***************************************
        *
        *  This is where the UTILITY METHODS are.
        *
        ***************************************/

        /// <summary>
        /// This clears the form after an entry is added.
        /// </summary>
        private void ClearForm()
        {
            TxtEmpID.Clear();
            TxtFirstName.Clear();
            TxtLastName.Clear();
            TxtMiddleName.Clear();
            TxtXtraProp1.Clear();
            TxtXtraProp2.Clear();
            CkbActiveEmployee.Checked = true;
            CkbBenefits.Checked       = true;
            CkbApproved.Checked       = true;
            LVxCourses.Items.Clear();
            TxtCourseID.Clear();
            TxtGrade.Clear();
            TxtDescription.Clear();
            TxtDateApproved.Clear();
            TxtCredits.Clear();
            TxtMaritalStatus.Clear();
            TxtDepartment.Clear();
            TxtTitle.Clear();
            TxtStartDate.Clear();
        }
예제 #19
0
 //method to fill register form
 public IWebElement Register(string fname, string lname, int date, string month, int year, string email, string passwrd)
 {
     TxtFirstName.SendKeys(fname);
     TxtLastName.SendKeys(lname);
     SelectDay.SendKeys(date.ToString());
     SelectMonth.SendKeys(month);
     SelectYear.SendKeys(year.ToString());
     TxtEmail.SendKeys(email);
     TxtPasswrd.SendKeys(passwrd);
     TxtConfirmPasswrd.SendKeys(passwrd);
     BtnRegister.Click();
     Console.WriteLine("Registering using MyAccountPage.Register");
     try
     {
         BtnContinue = PropertiesCollection.Driver.FindElement(By.Name("register-continue"));
     }
     catch (OpenQA.Selenium.NoSuchElementException)
     {
         BtnContinue = null;
     }
     Console.WriteLine(BtnContinue);
     return(BtnContinue);
 }
예제 #20
0
        private void OnErrorOccurred(object sender, EventArgs e)
        {
            if (_manageDriverViewModel.IsErrorInFirstName)
            {
                LblErrorMsg.Text = "First Name must be not null and contains alphabet only.";
                TxtFirstName.Focus();
                return;
            }

            if (_manageDriverViewModel.IsErrorInLastName)
            {
                LblErrorMsg.Text = "Last Name must be not null and contains alphabet only.";
                TxtLastName.Focus();
                return;
            }

            if (_manageDriverViewModel.IsErrorInUsername && _manageDriverViewModel.IsAddingDriver)
            {
                LblErrorMsg.Text = string.IsNullOrEmpty(_manageDriverViewModel.ErrorMessage) ? "Username must be not null and contains alphanumberic only." : _manageDriverViewModel.ErrorMessage;;
                TxtUsername.Focus();
                return;
            }

            if (_manageDriverViewModel.IsErrorInPin)
            {
                LblErrorMsg.Text = "Pin number must be four digit only, no any aphabet allowed.";
                TxtPin.Focus();
                return;
            }

            if (_manageDriverViewModel.IsErrorInGroup)
            {
                LblErrorMsg.Text = "Please select any Group.";
                CBGroup.Focus();
                return;
            }
        }
예제 #21
0
        public void Clear()
        {
            //  clear personal info
            if (AddPatientVar.ClearType == 0)
            {
                helper.ClearTextBox(TxtLastName);
                helper.ClearTextBox(TxtFirstName);
                helper.ClearTextBox(TxtPatNum);
                helper.SetDateToToday(DtStart);
                helper.ClearRadioBtn(RdoMale);
                helper.ClearRadioBtn(RdoFemale);
                helper.ClearMaskedTextBox(MTxtssn);
                TxtLastName.Focus();
            }

            //  clear home
            if (AddPatientVar.ClearType == 1)
            {
                helper.ClearTextBox(TxtAddress1);
                helper.ClearTextBox(TxtAddress2);
                helper.ClearTextBox(TxtCity);
                helper.ClearComboBoxTxt(CboState);
                helper.ClearMaskedTextBox(MTxtZip);
                helper.ClearMaskedTextBox(MTxtPhone);
                helper.ClearMaskedTextBox(MTxtCell);
                TxtAddress1.Focus();
            }

            //  clear surgery
            if (AddPatientVar.ClearType == 2)
            {
                helper.SetDateToToday(DtSurgeryDate);
                helper.SetDateToToday(DtFiscalYear);
                DtSurgeryDate.Focus();
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (TxtFirstName.Text == "" || TxtFirstName.Text == string.Empty)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child First Name')", true);
                TxtFirstName.Focus();
                return;
            }
            if (TxtLastName.Text == "" || TxtLastName.Text == string.Empty)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child Last Name')", true);
                TxtLastName.Focus();
                return;
            }

            if (TxtMiddleName.Text == "" || TxtMiddleName.Text == string.Empty)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child Middle Name')", true);
                TxtMiddleName.Focus();
                return;
            }
            if (TxtDOB.Text == "" || TxtDOB.Text == string.Empty)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child Date Of Birth')", true);
                TxtMiddleName.Focus();
                return;
            }
            if (TxtAdmissionDate.Text == "" || TxtAdmissionDate.Text == string.Empty)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Enquiry Date for Admission ')", true);
                TxtAdmissionDate.Focus();
                return;
            }
            if (TxtAddress.Text == "" || TxtAddress.Text == string.Empty)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Address')", true);
                TxtAddress.Focus();
                return;
            }
            if (TxtStandard.Text == "" || TxtStandard.Text == string.Empty)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Child Standard')", true);
                TxtStandard.Focus();
                return;
            }
            if (TxtWhatsupNumber.Text == "" || TxtWhatsupNumber.Text == string.Empty)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('please Enter Whats app Number For Contact')", true);
                TxtWhatsupNumber.Focus();
                return;
            }


            EWA_Admission objEWA = new EWA_Admission();
            BL_Admission  objBAL = new BL_Admission();


            objEWA.FirstName       = TxtFirstName.Text;
            objEWA.LastName        = TxtLastName.Text;
            objEWA.MiddleName      = TxtMiddleName.Text;
            objEWA.ParentEmail     = TxtEmail.Text;
            objEWA.MobileNo        = TxtWhatsupNumber.Text;
            objEWA.BirthDate       = TxtDOB.Text;
            objEWA.ApplicationDate = TxtAdmissionDate.Text;
            objEWA.Branch1         = TxtStandard.Text;
            objEWA.AddressLine1    = TxtAddress.Text;
            int flag = objBAL.InsertEnquiryInfo(objEWA);

            if (flag > 0)
            {
                Clear();
                msgBox.ShowMessage("Form Submitted  Successfully", "Saved", UserControls.MessageBox.MessageStyle.Successfull);
            }
            else
            {
                msgBox.ShowMessage("Some Problem Occured....", "Critical", UserControls.MessageBox.MessageStyle.Critical);
            }
        }
예제 #23
0
    private Boolean FieldValidation()
    {
        IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");
        DateTime      theCurrentDate = (DateTime)IQCareSecurity.SystemDate();
        IQCareUtils   theUtils       = new IQCareUtils();

        if (TxtFirstName.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "First Name";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtFirstName.Focus();
            return(false);
        }
        if (TxtLastName.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Last Name";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtLastName.Focus();
            return(false);
        }

        if (TxtAdmissionNo.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Last Name";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            return(false);
        }

        if (TxtRegistrationDate.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Registration Date";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtRegistrationDate.Focus();
            return(false);
        }
        DateTime theEnrolDate = Convert.ToDateTime(theUtils.MakeDate(TxtRegistrationDate.Text));

        if (theEnrolDate > theCurrentDate)
        {
            IQCareMsgBox.Show("EnrolDate", this);
            TxtRegistrationDate.Focus();
            return(false);
        }

        if (DDGender.SelectedValue == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Sex";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            DDGender.Focus();
            return(false);
        }

        if (TxtDOB.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "DOB";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtDOB.Focus();
            return(false);
        }
        DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDOB.Text));

        if (theDOBDate > theCurrentDate)
        {
            IQCareMsgBox.Show("DOBDate", this);
            TxtDOB.Focus();
            return(false);
        }

        if (theDOBDate > theEnrolDate)
        {
            IQCareMsgBox.Show("DOB_EnrolDate", this);
            return(false);
        }

        return(true);
    }
예제 #24
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            cn.Close();

            cn.Open();

            string     sql = "SELECT UserName from Manager where UserName=@un ";
            SqlCommand cmd = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = sql;
            cmd.Parameters.AddWithValue("un", TxtUserName.Text);


            dr = cmd.ExecuteReader();
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    username = dr["UserName"].ToString();
                }
            }

            dr.Close();
            cn.Close();

            if (username != null || username == "")
            {
                username         = username.ToLower();
                TxtUserName.Text = TxtUserName.Text.ToLower();
                if (username == TxtUserName.Text)
                {
                    LblError.Visible = true;
                    LblError.Text    = "The username '" + TxtUserName.Text + "' is Already Entered ";
                    return;
                }
                else
                {
                    LblError.Visible = false;
                }
            }
            else
            {
                LblError.Visible = false;
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
            cn.Close();
        }
        try
        {
            if (TxtUserName.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter user name";
                TxtUserName.Focus();
                return;
            }
            if (TxtPassword.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please Password";
                TxtPassword.Focus();
                return;
            }
            if (TxtEmail.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter Email";
                TxtEmail.Focus();
                return;
            }
            if (TxtFirstName.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter First Name";
                TxtFirstName.Focus();
                return;
            }
            if (TxtLastName.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter Last Name";
                TxtLastName.Focus();
                return;
            }
            cn.Open();

            string dob = ddlDay.Text + "/" + ddlMonth.Text + "/" + ddlYear.Text;

            DateTimeFormatInfo StartDate = new DateTimeFormatInfo();
            StartDate.ShortDatePattern = "dd/MM/yyyy";
            StartDate.DateSeparator    = "/";
            DateTime objDate = Convert.ToDateTime(dob, StartDate);

            DateTime   jd = DateTime.Now;
            SqlCommand cm = new SqlCommand(
                "INSERT INTO Manager (First_Name, Last_Name, DOB, Occupation, Designation, Monthly_Salary, Email, Address, Country, City, PostalCode, Phone_Number, Status, Joining_Date, Password,Dept_Id, UserName, SQ1, Answer1, SQ2, Answer2, SQ3, Answer3) VALUES(@First_Name, @Last_Name, @DOB, @Occupation, @Designation, @Monthly_Salary, @Email, @Address, @Country, @City, @PostalCode, @Phone_Number, @Status, @Joining_Date, @Password,@Dept_Id, @User_Name, @SQ1, @Answer1, @SQ2, @Answer2, @SQ3, @Answer3)", cn);
            cm.Parameters.Add("@First_Name", TxtFirstName.Text);
            cm.Parameters.Add("@Last_Name", TxtLastName.Text);
            cm.Parameters.Add("@DOB", objDate);
            cm.Parameters.Add("@Occupation", TxtOccupation.Text);
            cm.Parameters.Add("@Designation", TxtDesignation.Text);
            cm.Parameters.Add("@Monthly_Salary", TxtSalary.Text);
            cm.Parameters.Add("@Email", TxtEmail.Text);
            cm.Parameters.Add("@Address", TxtAddress.Text);
            cm.Parameters.Add("@Country", TxtCountry.Text);
            cm.Parameters.Add("@City", TxtCity.Text);
            cm.Parameters.Add("@PostalCode", TxtPostalCode.Text);
            cm.Parameters.Add("@Phone_Number", TxtPhoneNo.Text);
            cm.Parameters.Add("@Status", TxtStatus.Text);
            cm.Parameters.Add("@Joining_Date", jd);
            cm.Parameters.Add("@Password", EncryptPasswrod(TxtPassword.Text));
            cm.Parameters.Add("@Dept_Id", DDLAccountType.Text);
            cm.Parameters.Add("@User_Name", TxtUserName.Text);
            cm.Parameters.Add("@SQ1", TxtQ1.Text);
            cm.Parameters.Add("@Answer1", TxtA1.Text);
            cm.Parameters.Add("@SQ2", TxtQ2.Text);
            cm.Parameters.Add("@Answer2", TxtA2.Text);
            cm.Parameters.Add("@SQ3", TxtQ3.Text);
            cm.Parameters.Add("@Answer3", TxtA3.Text);



            cm.ExecuteNonQuery();

            cm.Clone();


            cn.Close();
            LblError.Visible = true;
            LblError.Text    = "An Email is sent to A Manager /n Account Added Successfully";

            try
            {
                string emailfrom = "*****@*****.**";
                string pwd       = "inse6260";
                string sb        = "Welcome to INSE 6260 Bank ";

                string bd = "Dear Manager! Toy Account Has been Created successfully /n : Your user name to Login is :" + TxtUserName.Text + " and Password is:" + TxtPassword.Text + " and Security Questions Answer is apple";

                MailMessage msg = new MailMessage();
                msg.From = new MailAddress(emailfrom);

                msg.To.Add(TxtEmail.Text);
                msg.Subject = sb;
                msg.Body    = bd;

                SmtpClient sc = new SmtpClient("smtp.gmail.com");

                sc.Port = 587;

                sc.Credentials = new NetworkCredential(emailfrom, pwd);

                sc.EnableSsl = true;

                sc.Send(msg);

                Response.Write("mail send successfully");

                TxtFirstName.Text   = "";
                TxtLastName.Text    = "";
                TxtOccupation.Text  = "";
                TxtDesignation.Text = "";
                TxtSalary.Text      = "";
                TxtEmail.Text       = "";
                TxtAddress.Text     = "";
                TxtCity.Text        = "";
                TxtPostalCode.Text  = "";
                TxtPhoneNo.Text     = "";
                TxtStatus.Text      = "";
                TxtUserName.Text    = "";
                TxtPassword.Text    = "";
                TxtA1.Text          = "";
                TxtA2.Text          = "";
                TxtA3.Text          = "";

                Response.Redirect("~/Admin/AdminMenu.aspx", false);
            }
            catch (Exception ex)
            {
            }
        }
        catch
        { }
    }
    private Boolean FieldValidation()
    {
        IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");
        DateTime      theCurrentDate = (DateTime)IQCareSecurity.SystemDate();
        IQCareUtils   theUtils       = new IQCareUtils();

        if (DDFinalResult.SelectedItem.Value == "9")
        {
            spDeath.Visible = true;
        }

        if (TxtFirstName.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "First Name";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtFirstName.Focus();
            return(false);
        }
        if (TxtLastName.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Last Name";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtLastName.Focus();
            return(false);
        }

        if (TxtInfantId.Text.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Infant ID";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtInfantId.Focus();
            return(false);
        }

        try
        {
            int i = Convert.ToInt32(TxtInfantId.Text);
        }
        catch
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "Infant ID";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtDateOfBirth.Focus();
            return(false);
        }

        if (TxtDateOfBirth.Value.Trim() == "")
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["Control"] = "DOB";
            IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
            TxtDateOfBirth.Focus();
            return(false);
        }
        DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDateOfBirth.Value));

        if (theDOBDate > theCurrentDate)
        {
            IQCareMsgBox.Show("DOBDate", this);
            TxtDateOfBirth.Focus();
            return(false);
        }

        if (TxtDeathDate.Text != "")
        {
            spDeath.Visible = true;

            DateTime theDeathDate = Convert.ToDateTime(theUtils.MakeDate(TxtDeathDate.Text));
            if (theDeathDate > theCurrentDate)
            {
                IQCareMsgBox.Show("DeathDateCheck", this);
                TxtDeathDate.Focus();
                return(false);
            }
            if (theDeathDate < theDOBDate)
            {
                IQCareMsgBox.Show("DeathDOBDate", this);
                TxtDeathDate.Focus();
                return(false);
            }
        }



        //if (DDInfantFeedingPractice.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantFeed", this);
        //    DDInfantFeedingPractice.Focus();
        //    return false;
        //}
        //if (DDHIVTestType.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantHivTestType", this);
        //    DDHIVTestType.Focus();
        //    return false;
        //}
        //if (DDResult.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantResult", this);
        //    DDResult.Focus();
        //    return false;
        //}

        //if (DDFinalResult.SelectedItem.Value.Trim() == "0")
        //{
        //    IQCareMsgBox.Show("InfantFinalResult", this);
        //    DDFinalResult.Focus();
        //    return false;
        //}
        return(true);
    }
예제 #26
0
        void ReleaseDesignerOutlets()
        {
            if (BtnAddGroup != null)
            {
                BtnAddGroup.Dispose();
                BtnAddGroup = null;
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (TxtUsername != null)
            {
                TxtUsername.Dispose();
                TxtUsername = null;
            }
        }
예제 #27
0
        void ReleaseDesignerOutlets()
        {
            if (BtnAddGroup != null)
            {
                BtnAddGroup.Dispose();
                BtnAddGroup = null;
            }

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

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

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

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

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

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

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

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

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

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

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

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

            if (LoginAsUser != null)
            {
                LoginAsUser.Dispose();
                LoginAsUser = null;
            }
        }
예제 #28
0
        private void InitComponent()
        {
            try
            {
                TxtNameIcon = FindViewById <TextView>(Resource.Id.name_icon);
                TxtFullname = FindViewById <TextView>(Resource.Id.Txt_fullname);
                TxtUserName = FindViewById <TextView>(Resource.Id.username);

                TxtFollowers      = FindViewById <TextView>(Resource.Id.Txt_flowersView);
                TxtFollowersCount = FindViewById <TextView>(Resource.Id.Txt_flowers_count);

                TxtFollowing      = FindViewById <TextView>(Resource.Id.flowinglabelView);
                TxtFollowingCount = FindViewById <TextView>(Resource.Id.Txt_flowing_countView);

                TxtFirstName = FindViewById <EditText>(Resource.Id.FirstName_text);
                TxtLastName  = FindViewById <EditText>(Resource.Id.LastName_text);

                UserProfileImage = FindViewById <ImageView>(Resource.Id.profile_image);
                CoverImage       = FindViewById <ImageView>(Resource.Id.coverImageView);

                TxtGenderIcon = FindViewById <TextView>(Resource.Id.gender_icon);
                TxtGenderText = FindViewById <EditText>(Resource.Id.gender_text);

                TxtLocationIcon = FindViewById <TextView>(Resource.Id.location_icon);
                TxtLocationText = FindViewById <EditText>(Resource.Id.location_text);

                TxtMobileIcon = FindViewById <TextView>(Resource.Id.mobile_icon);
                TxtMobileText = FindViewById <EditText>(Resource.Id.mobile_text);

                TxtWebsiteIcon = FindViewById <TextView>(Resource.Id.website_icon);
                TxtWebsiteText = FindViewById <EditText>(Resource.Id.website_text);

                TxtWorkIcon = FindViewById <TextView>(Resource.Id.work_icon);
                TxtWorkText = FindViewById <EditText>(Resource.Id.work_text);

                TxtFacebookIcon  = FindViewById <TextView>(Resource.Id.facebook_icon);
                TxtFacebookText  = FindViewById <EditText>(Resource.Id.facebook_text);
                TxtGoogleIcon    = FindViewById <TextView>(Resource.Id.Google_icon);
                TxtGoogleText    = FindViewById <EditText>(Resource.Id.Google_text);
                TxtTwitterIcon   = FindViewById <TextView>(Resource.Id.Twitter_icon);
                TxtTwitterText   = FindViewById <EditText>(Resource.Id.Twitter_text);
                TxtVkIcon        = FindViewById <TextView>(Resource.Id.VK_icon);
                TxtVkText        = FindViewById <EditText>(Resource.Id.VK_text);
                TxtInstagramIcon = FindViewById <TextView>(Resource.Id.Instagram_icon);
                TxtInstagramText = FindViewById <EditText>(Resource.Id.Instagram_text);
                TxtYoutubeIcon   = FindViewById <TextView>(Resource.Id.Youtube_icon);
                TxtYoutubeText   = FindViewById <EditText>(Resource.Id.Youtube_text);

                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtGenderIcon, IonIconsFonts.Male);
                TxtGenderIcon.SetTextColor(Color.ParseColor("#4693d8"));

                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtLocationIcon, IonIconsFonts.Location);
                TxtLocationIcon.SetTextColor(Color.ParseColor(AppSettings.MainColor));

                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtMobileIcon, IonIconsFonts.AndroidCall);
                TxtMobileIcon.SetTextColor(Color.ParseColor("#fa6670"));

                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtWebsiteIcon, IonIconsFonts.AndroidGlobe);
                TxtWebsiteIcon.SetTextColor(Color.ParseColor("#6b38d1"));

                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtWorkIcon, IonIconsFonts.Briefcase);
                TxtWorkIcon.SetTextColor(Color.ParseColor("#eca72c"));

                EditProfileButton = FindViewById <CircleButton>(Resource.Id.Edit_button);
                //EditProfile_button.Click += EditProfileButtonOnClick;
                EditProfileButton.Visibility = ViewStates.Invisible;
                EditProfileButton.SetColor(Color.ParseColor("#282828"));

                if (AppSettings.SetTabDarkTheme)
                {
                    TxtFirstName.SetTextColor(Color.White);
                    TxtFirstName.SetHintTextColor(Color.White);

                    TxtLastName.SetTextColor(Color.White);
                    TxtLastName.SetHintTextColor(Color.White);

                    TxtGenderText.SetTextColor(Color.White);
                    TxtGenderText.SetHintTextColor(Color.White);

                    TxtLocationText.SetTextColor(Color.White);
                    TxtLocationText.SetHintTextColor(Color.White);

                    TxtMobileText.SetTextColor(Color.White);
                    TxtMobileText.SetHintTextColor(Color.White);

                    TxtWebsiteText.SetTextColor(Color.White);
                    TxtWebsiteText.SetHintTextColor(Color.White);

                    TxtWorkText.SetTextColor(Color.White);
                    TxtWorkText.SetHintTextColor(Color.White);

                    TxtFacebookText.SetTextColor(Color.White);
                    TxtFacebookText.SetHintTextColor(Color.White);

                    TxtGoogleText.SetTextColor(Color.White);
                    TxtGoogleText.SetHintTextColor(Color.White);

                    TxtTwitterText.SetTextColor(Color.White);
                    TxtTwitterText.SetHintTextColor(Color.White);

                    TxtVkText.SetTextColor(Color.White);
                    TxtVkText.SetHintTextColor(Color.White);

                    TxtInstagramText.SetTextColor(Color.White);
                    TxtInstagramText.SetHintTextColor(Color.White);

                    TxtYoutubeText.SetTextColor(Color.White);
                    TxtYoutubeText.SetHintTextColor(Color.White);
                }
                else
                {
                    TxtFirstName.SetTextColor(Color.Black);
                    TxtFirstName.SetHintTextColor(Color.Black);

                    TxtLastName.SetTextColor(Color.Black);
                    TxtLastName.SetHintTextColor(Color.Black);

                    TxtGenderText.SetTextColor(Color.Black);
                    TxtGenderText.SetHintTextColor(Color.Black);

                    TxtLocationText.SetTextColor(Color.Black);
                    TxtLocationText.SetHintTextColor(Color.Black);

                    TxtMobileText.SetTextColor(Color.Black);
                    TxtMobileText.SetHintTextColor(Color.Black);

                    TxtWebsiteText.SetTextColor(Color.Black);
                    TxtWebsiteText.SetHintTextColor(Color.Black);

                    TxtWorkText.SetTextColor(Color.Black);
                    TxtWorkText.SetHintTextColor(Color.Black);

                    TxtFacebookText.SetTextColor(Color.Black);
                    TxtFacebookText.SetHintTextColor(Color.Black);

                    TxtGoogleText.SetTextColor(Color.Black);
                    TxtGoogleText.SetHintTextColor(Color.Black);

                    TxtTwitterText.SetTextColor(Color.Black);
                    TxtTwitterText.SetHintTextColor(Color.Black);

                    TxtVkText.SetTextColor(Color.Black);
                    TxtVkText.SetHintTextColor(Color.Black);

                    TxtInstagramText.SetTextColor(Color.Black);
                    TxtInstagramText.SetHintTextColor(Color.Black);

                    TxtYoutubeText.SetTextColor(Color.Black);
                    TxtYoutubeText.SetHintTextColor(Color.Black);
                }


                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtNameIcon, IonIconsFonts.Person);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtFacebookIcon, IonIconsFonts.SocialFacebook);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtGoogleIcon, IonIconsFonts.SocialGoogle);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtTwitterIcon, IonIconsFonts.SocialTwitter);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeBrands, TxtVkIcon, FontAwesomeIcon.Vk);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtInstagramIcon, IonIconsFonts.SocialInstagram);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TxtYoutubeIcon, IonIconsFonts.SocialYoutube);

                TxtGenderText.SetFocusable(ViewFocusability.NotFocusable);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #29
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtIDNUMBER.Text == "")
            {
                MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                txtIDNUMBER.Focus();
            }
            else if (TxtFirstName.Text == "")
            {
                MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                TxtFirstName.Focus();
            }
            else if (TxtLastName.Text == "")
            {
                MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                TxtLastName.Focus();
            }
            else if (TxtMiddleName.Text == "")
            {
                MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                TxtLastName.Focus();
            }

            else if (TxtEmailAddress.Text == "")
            {
                MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                TxtEmailAddress.Focus();
            }

            else if (cboPOstion.SelectedValue.ToString() == "")//Nothing selected
            {
                MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                cboPOstion.Focus();
            }
            else if (cboDepartments.SelectedValue.ToString() == "")//Nothing selected
            {
                MessageBox.Show("This field is required!.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                cboDepartments.Focus();
            }

            else
            {
                string StringReturn = "";


                SqlConnection con = new SqlConnection(conStr);
                SqlCommand    cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.CommandText = "TRAN_SAVEWORKER";
                cmd.Parameters.Add("@IDRef", SqlDbType.VarChar, 15).Value = txtIDNUMBER.Text.ToString();

                cmd.Parameters.Add("@Lastname", SqlDbType.VarChar, 100).Value      = TxtLastName.Text.ToString();
                cmd.Parameters.Add("@Firstname", SqlDbType.VarChar, 100).Value     = TxtFirstName.Text.ToString();
                cmd.Parameters.Add("@MidName", SqlDbType.VarChar, 100).Value       = TxtMiddleName.Text.ToString();
                cmd.Parameters.Add("@EmailAddress", SqlDbType.VarChar, 100).Value  = TxtEmailAddress.Text.ToString();
                cmd.Parameters.Add("@DesignationCode", SqlDbType.VarChar, 4).Value = cboPOstion.SelectedValue.ToString();

                cmd.Parameters.Add("@DeptCode", SqlDbType.VarChar, 15).Value = cboDepartments.SelectedValue.ToString();

                cmd.Connection = con;
                try
                {
                    con.Open();
                    StringReturn = cmd.ExecuteScalar().ToString();
                    if (StringReturn == "EXISTS")
                    {
                        MessageBox.Show("ID Number Already Exists", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                    }



                    if (StringReturn == "DONE")
                    {
                        MessageBox.Show("Record Saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);


                        UserMaintainance um = new UserMaintainance();


                        um.Show();
                        this.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    con.Close();
                    con.Dispose();
                }
            }
        }
예제 #30
0
        private Boolean FieldValidation()
        {
            IIQCareSystem IQCareSecurity = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");
            DateTime      theCurrentDate = (DateTime)IQCareSecurity.SystemDate();
            IQCareUtils   theUtils       = new IQCareUtils();

            if (TxtFirstName.Text.Trim() == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "First Name";
                IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
                TxtFirstName.Focus();
                return(false);
            }
            if (TxtLastName.Text.Trim() == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Last Name";
                IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
                TxtLastName.Focus();
                return(false);
            }

            if (TxtRegistrationDate.Text.Trim() == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Registration Date";
                IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
                TxtRegistrationDate.Focus();
                return(false);
            }
            DateTime theEnrolDate = Convert.ToDateTime(theUtils.MakeDate(TxtRegistrationDate.Text));

            if (theEnrolDate > theCurrentDate)
            {
                IQCareMsgBox.Show("EnrolDate", this);
                TxtRegistrationDate.Focus();
                return(false);
            }

            if (DDGender.SelectedValue == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Sex";
                IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
                DDGender.Focus();
                return(false);
            }

            if (TxtDOB.Text.Trim() == "")
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "DOB";
                IQCareMsgBox.Show("BlankTextBox", theBuilder, this);
                TxtDOB.Focus();
                return(false);
            }
            DateTime theDOBDate = Convert.ToDateTime(theUtils.MakeDate(TxtDOB.Text));

            if (theDOBDate > theCurrentDate)
            {
                IQCareMsgBox.Show("DOBDate", this);
                TxtDOB.Focus();
                return(false);
            }

            if (theDOBDate > theEnrolDate)
            {
                IQCareMsgBox.Show("DOB_EnrolDate", this);
                return(false);
            }
            /////17-09-09
            //if (chkTransferIn.Checked == true && ddReferredFrom.SelectedIndex != 0)
            //{
            //   // //MsgBuilder theBuilder = new MsgBuilder();
            //   // theBuilder.DataElements["Control"] = "RefFrom";
            //   //// IQCareMsgBox.Show("BlankDropDown", theBuilder, this);
            //    return false;
            //  }


            ////17-09-09
            if (chkTransferIn.Checked == false && ddReferredFrom.SelectedIndex != 0)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Either Tranfer in/Referred From";
                IQCareMsgBox.Show("BlankDropDown", theBuilder, this);
                return(false);
            }

            if (chkTransferIn.Checked == true && ddReferredFrom.SelectedIndex == 0)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["Control"] = "Either Tranfer in/Referred From";
                IQCareMsgBox.Show("BlankDropDown", theBuilder, this);
                return(false);
            }

            if (TxtANCNumber.Text == "" && TxtPMTCTNumber.Text == "" && TxtAdmissionNumber.Text == "" && TxtOutPatientNumber.Text == "")
            {
                IQCareMsgBox.Show("PMTCTEnrol_ANC", this);
                return(false);
            }

            IPatientRegistration ValMgrPMTCT = (IPatientRegistration)ObjectFactory.CreateInstance(ObjFactoryParameter);
            string msg = "";

            if (TxtANCNumber.Text != "")
            {
                DataTable theDT = ValMgrPMTCT.Validate(TxtANCNumber.Text, "ANC");

                if (theDT.Rows.Count > 0)
                {
                    //if (Request.QueryString["Name"] == "Edit")
                    if (Convert.ToInt32(Session["PatientId"]) > 0) //i.e. update mode
                    {
                        if (theDT.Rows[0]["IDNumber"].ToString() != Convert.ToString(ViewState["ANC"]))
                        {
                            msg = "ANC" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this);
                            MsgBuilder theBuilder = new MsgBuilder();
                            theBuilder.DataElements["MessageText"] = msg;
                            IQCareMsgBox.Show("#C1", theBuilder, this);
                            return(false);
                        }
                    }
                    else
                    {
                        msg = "ANC" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this);
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["MessageText"] = msg;
                        IQCareMsgBox.Show("#C1", theBuilder, this);
                        return(false);
                    }
                }
            }

            if (TxtPMTCTNumber.Text != "")
            {
                DataTable theDT = ValMgrPMTCT.Validate(TxtPMTCTNumber.Text, "PMTCT");
                if (theDT.Rows.Count > 0)
                {
                    //if (Request.QueryString["Name"] == "Edit")
                    //if (Request.QueryString["Name"] != "Add") //i.e. edit mode
                    if (Convert.ToInt32(Session["PatientId"]) > 0)
                    {
                        if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["PMTCT"].ToString())
                        {
                            msg = "PMTCT" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this);
                            MsgBuilder theBuilder = new MsgBuilder();
                            theBuilder.DataElements["MessageText"] = msg;
                            IQCareMsgBox.Show("#C1", theBuilder, this);
                            return(false);
                        }
                    }
                    else
                    {
                        msg = "PMTCT" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this);
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["MessageText"] = msg;
                        IQCareMsgBox.Show("#C1", theBuilder, this);
                        return(false);
                    }
                }
            }

            if (TxtAdmissionNumber.Text != "")
            {
                DataTable theDT = ValMgrPMTCT.Validate(TxtAdmissionNumber.Text, "Admission");
                if (theDT.Rows.Count > 0)
                {
                    //if (Request.QueryString["Name"] == "Edit")
                    //if (Request.QueryString["Name"] != "Add") //i.e. edit mode
                    if (Convert.ToInt32(Session["PatientId"]) > 0)
                    {
                        if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["Admission"].ToString())
                        {
                            msg = "Admission" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this);
                            MsgBuilder theBuilder = new MsgBuilder();
                            theBuilder.DataElements["MessageText"] = msg;
                            IQCareMsgBox.Show("#C1", theBuilder, this);
                            return(false);
                        }
                    }
                    else
                    {
                        msg = "Admission" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this);
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["MessageText"] = msg;
                        IQCareMsgBox.Show("#C1", theBuilder, this);
                        return(false);
                    }
                }
            }
            if (TxtOutPatientNumber.Text != "")
            {
                DataTable theDT = ValMgrPMTCT.Validate(TxtOutPatientNumber.Text, "Outpatient");
                if (theDT.Rows.Count > 0)
                {
                    //if (Request.QueryString["Name"] == "Edit")
                    //if (Request.QueryString["Name"] != "Add") //i.e. edit mode
                    if (Convert.ToInt32(Session["PatientId"]) > 0)
                    {
                        if (theDT.Rows[0]["IDNumber"].ToString() != ViewState["Outpatient"].ToString())
                        {
                            msg = "OutpatientNumber" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this);
                            MsgBuilder theBuilder = new MsgBuilder();
                            theBuilder.DataElements["MessageText"] = msg;
                            IQCareMsgBox.Show("#C1", theBuilder, this);
                            return(false);
                        }
                    }
                    else
                    {
                        msg = "OutpatientNumber" + "' '" + IQCareMsgBox.GetMessage("PMTCTDuplicate", this);
                        MsgBuilder theBuilder = new MsgBuilder();
                        theBuilder.DataElements["MessageText"] = msg;
                        IQCareMsgBox.Show("#C1", theBuilder, this);
                        return(false);
                    }
                }
            }



            return(true);
        }