예제 #1
0
        private bool ValidateBeforeAdd()
        {
            try
            {
                bool result = true;

                // name
                if (string.IsNullOrEmpty(nameTextBoxX.Text))
                {
                    errorProvider1.SetError(nameTextBoxX, "Please Enter Name");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(nameTextBoxX, string.Empty);
                }

                return(result);
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
                return(false);
            }
        }
예제 #2
0
        public void FillSearchFilds(Hashtable hashtable)
        {
            try
            {
                userID = (int)hashtable["ID"];

                using (User user = new User(true))
                {
                    user.SelectUser(userID);



                    fNameTxt.Text    = user.Name;
                    emailText.Text   = user.Email;
                    usernameTxt.Text = user.UserName;
                    //rePasswordTxt.Text = passwordTxt.Text = hashtable["Pwd"].ToString();
                    mobileTPTxt.Text             = user.Mobile;
                    userLevelCombo.SelectedIndex = user.PermissionLevel;
                    emailText.Text = user.Email;

                    rePasswordTxt.Enabled     = passwordTxt.Enabled = false;
                    changePwsCheckbox.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #3
0
        private void buttonX3_Click(object sender, EventArgs e)
        {
            try
            {
                using (Item item = new Item(true))
                {
                    item.Name = nameTxt.Text;
                    item.Code = idTxt.Text == null ? string.Empty : idTxt.Text;
                    //item.Cost = (double)costNud.Value;
                    //item.Price = (double)priceNUD.Value;
                    //item.InStock = (int)inStockNUD.Value;
                    item.MainCategory = categoryCombo.SelectedValue == null ? -1 : (int)categoryCombo.SelectedValue;
                    //item.SubCategory = subcategoryCombo.SelectedValue == null ? 0 : (int)subcategoryCombo.SelectedValue;

                    DataTable ds     = item.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 4);
                    frmSub.Width = 800;
                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #4
0
파일: frmMemberNDF.cs 프로젝트: jmkasun/YBS
        private void setPictureFromFile(string fileName)
        {
            try
            {
                Image img = Image.FromFile(fileName);

                // set byte array
                MemoryStream mem = new MemoryStream();
                //  picDriverImage.Image.Save(mem, ImageFormat.Png);

                img.Save(mem, ImageFormat.Jpeg);
                imageData = mem.ToArray();

                if (imageData.Length > 512000)
                {
                    MessageView.ShowErrorMsg("Image is too large,Maximum size is 500KB");
                    imageData = null;
                    return;
                }


                pictureBox.Image = getThumbImage(img);
                img.Save("test.jpg", ImageFormat.Jpeg);
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #5
0
        private void setPictureFromFile(string fileName)
        {
            try
            {
                Image img = Image.FromFile(fileName);

                // set byte array
                MemoryStream mem = new MemoryStream();
                //  picDriverImage.Image.Save(mem, ImageFormat.Png);

                img.Save(mem, ImageFormat.Jpeg);
                bikkuImage = mem.ToArray();

                //if (img.Width >5000 || img.Height > 5000)
                //{
                //    MessageView.ShowErrorMsg("Image is too large,Maximum scale is 5000 X 5000");
                //    bikkuImage = null;
                //    return;
                //}


                pictureBox.Image = getThumbImage(img);
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #6
0
        public void FillSearchFilds(Hashtable hashtable)
        {
            try
            {
                asapuwaID = (int)hashtable["ID"];

                nameTextBoxX.Text           = hashtable["AsapuwaName"].ToString();
                addressTextBox.Text         = hashtable["Address"].ToString();
                tp1textBox.Text             = hashtable["ContactNumber1"].ToString();
                tp2TextBox.Text             = hashtable["ContactNumber2"].ToString();
                districtCombo.SelectedValue = (int)hashtable["DistrictID"];
                dateOfOpenDtm.Value         = (DateTime)hashtable["OpeningDate"];
                postalcodeTextbox.Text      = hashtable["PostalCode"].ToString();
                numberOfKutiTxt.Value       = (int)hashtable["NumberOfKuti"];

                int country = (int)hashtable["Country"];
                if (country == 0)
                {
                    countryCombo.Text         = "";
                    countryCombo.SelectedText = "ශ්‍රී ලංකාව";
                }
                else
                {
                    countryCombo.SelectedValue = country;
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #7
0
        private bool validateAsapuHistry()
        {
            try
            {
                bool result = true;

                // asapuwa
                if (asapuHistrAsapu.SelectedValue == null)
                {
                    errorProvider1.SetError(asapuHistrAsapu, "Please Select Asapuwa");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(asapuHistrAsapu, string.Empty);
                }


                if (asapuHistryFrom.Value == new DateTime())
                {
                    errorProvider1.SetError(asapuHistryFrom, "Please Select 'From Date'");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(asapuHistryFrom, string.Empty);
                }

                if (asapuHistryTo.Value == new DateTime())
                {
                    errorProvider1.SetError(asapuHistryTo, "Please Select 'To Date'");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(asapuHistryTo, string.Empty);

                    if (asapuHistryTo.Value < asapuHistryFrom.Value)
                    {
                        errorProvider1.SetError(asapuHistryTo, "'To Date' Must greater Than 'From Date'");
                        result = false;
                    }
                    else
                    {
                        errorProvider1.SetError(asapuHistryTo, string.Empty);
                    }
                }

                return(result);
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
                return(false);
            }
        }
예제 #8
0
        //private void agaDivisionButtonItem_Click(object sender, EventArgs e)
        //{
        //    ShowAGADivisionForm();
        //}

        public void ViewChildForm(Form frmObj)
        {
            try
            {
                ViewChildForm(frmObj, false);
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #9
0
 public void FillSearchFilds(Hashtable hashtable)
 {
     try
     {
         ID = (int)hashtable["ID"];
         nameTextBoxX.Text = hashtable["Value"].ToString();
     }
     catch (Exception ex)
     {
         MessageView.ExceptionError(ex);
     }
 }
예제 #10
0
        public void FillSearchFilds(Hashtable hashtable)
        {
            try
            {
                bhikkuID = (int)hashtable["ID"];

                using (BikkuInfo bInfo = new BikkuInfo(true))
                {
                    bInfo.SelectBhikku(bhikkuID);


                    nicTextBoxX.Text            = bInfo.NIC;
                    samaneraNumberTextBoxX.Text = bInfo.SamaneraNumber;
                    passportNumbrtTextBoxX.Text = bInfo.PassportNumber;
                    placeOfBirthtxt.Text        = bInfo.PlaceOfBirth;
                    layNameinFullTxt.Text       = bInfo.LayNameInFull;
                    dobDtm.Value = bInfo.DateOfBirth;
                    nameOfFatheinFullTxt.Text     = bInfo.NameOfFatherInFull;
                    dateOfRobingDtm.Value         = bInfo.DateOfRobing;
                    nameOfAssumedAtRobinTxt.Text  = bInfo.NameAssumedAtRobing;
                    isUpasampannaCheckBox.Checked = bInfo.IsUpasampanna;
                    upasampannaDatetp.Value       = bInfo.DateOfHigherOrdination;
                    //isSangaUpasCheckBox.Checked = bInfo.Post;
                    isUpadyaCheckBox.Checked                 = bInfo.IsUpadyaThero;
                    districtcomboBox.SelectedValue           = bInfo.District;
                    dateofCameDtm.Value                      = bInfo.DateOfCame;
                    upasampannaPlaceComboBoxEx.SelectedValue = bInfo.PlaceOfHigherOrdination;
                    nameOfRobingTutorCombo.SelectedValue     = bInfo.NameOfRobingTutor;
                    templaRobingTookCombo.SelectedValue      = bInfo.TempleRobing;
                    templaResidenceCombo.SelectedValue       = TempleOfResidenceBeforeChange = bInfo.TempleOfResidence;
                    TempleOfResidenceBeforeChangeName        = templaResidenceCombo.Text;
                    nameOfViharadhipathiCombo.SelectedValue  = bInfo.NameOfViharadhipathi;
                    nameofUpadyaComboBoxEx.SelectedValue     = bInfo.NameOfUpadyaAtHigherOrdination;

                    if (!string.IsNullOrEmpty(bInfo.ImageData))
                    {
                        setDriverPictureFromByteArray(Utility.GetByte64String(bInfo.ImageData));
                    }

                    setActivities(bInfo.Activities);
                    setAsapuHistry(bInfo.AsapuHistry);
                    setOtherData(bInfo.OtherData);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #11
0
파일: frmMemberNDF.cs 프로젝트: jmkasun/YBS
 private void pictureBox_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     try
     {
         OpenFileDialog fd = new OpenFileDialog();
         //  fd.Filter = "Image files|*.jpeg|*.jpg|*.png";
         if (fd.ShowDialog() == DialogResult.OK)
         {
             setPictureFromFile(fd.FileName);
         }
     }
     catch (Exception ex)
     {
         MessageView.ExceptionError(ex);
     }
 }
예제 #12
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateBeforeAdd())
                {
                    using (User user = new User(true))
                    {
                        user.Name            = fNameTxt.Text;
                        user.UserName        = usernameTxt.Text;
                        user.Password        = passwordTxt.Text.GetHashCode();
                        user.Mobile          = mobileTPTxt.Text;
                        user.PermissionLevel = userLevelCombo.SelectedIndex;
                        user.Email           = emailText.Text;

                        if (validateName(user, userID))
                        {
                            if (userID == 0)
                            {
                                if (user.Add() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully added");
                                    clear();
                                }
                            }
                            else
                            {
                                user.ID = userID;
                                if (MessageView.ShowQuestionMsg("Update Current User") == DialogResult.OK)
                                {
                                    if (user.Update(changePwsCheckbox.Checked) == 1)
                                    {
                                        MessageView.ShowMsg("Sucessfully Updated");

                                        clear();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #13
0
        public void FillSearchFilds(Hashtable hashtable)
        {
            try
            {
                memberID = (int)hashtable["ID"];

                using (MemberInfo memInfo = new MemberInfo(true))
                {
                    memInfo.SelectMember(memberID);

                    findMember(memInfo);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #14
0
        public void FillSearchFilds(Hashtable hashtable)
        {
            try
            {
                addressID = (int)hashtable["ID"];

                using (OtherAddress adr = new OtherAddress(true))
                {
                    adr.Select(addressID);

                    setFieldValsues(adr);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #15
0
파일: frmMemberNDF.cs 프로젝트: jmkasun/YBS
        public void FillSearchFilds(int memberID)
        {
            try
            {
                this.memberID = memberID;

                using (MemberInfo memInfo = new MemberInfo(true, memberType))
                {
                    memInfo.SelectMember(memberID);

                    SetMemberFields(memInfo);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #16
0
 public void FillSearchFilds(Hashtable hashtable)
 {
     try
     {
         itemID                         = (int)hashtable["ID"];
         nameTxt.Text                   = hashtable["ItemName"].ToString();
         idTxt.Text                     = hashtable["ItemCode"].ToString();
         costNud.Value                  = Convert.ToDecimal(hashtable["Cost"]);
         priceNUD.Value                 = Convert.ToDecimal(hashtable["Price"]);
         inStockNUD.Value               = Convert.ToDecimal(hashtable["InStock"]);
         categoryCombo.SelectedValue    = (int)hashtable["Category"];
         subcategoryCombo.SelectedValue = (int)hashtable["SubCategory"];
         customPriceCheckbox.Checked    = (bool)hashtable["CustomPrice"];
     }
     catch (Exception ex)
     {
         MessageView.ExceptionError(ex);
     }
 }
예제 #17
0
        private void findButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (OtherAddress addre = new OtherAddress(true))
                {
                    setObjectFromFieldValues(addre);

                    DataTable ds     = addre.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 3, 50);
                    frmSub.Width = 800;
                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #18
0
        private void findButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (Category sc = new Category(true))
                {
                    sc.Name = nameTextBoxX.Text;

                    DataTable ds     = sc.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 1);
                    frmSub.Width = 800;
                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #19
0
        private void findButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (EduQualifications edu = new EduQualifications(true))
                {
                    edu.Name = nameTextBoxX.Text;

                    DataTable ds     = edu.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 1);
                    frmSub.Width = 800;
                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #20
0
 private void setBhikkuPictureFromByteArray(string imageData)
 {
     try
     {
         if (string.IsNullOrEmpty(imageData))
         {
             bhikkuImagePicBox.Image = null;
         }
         else
         {
             // set byte array
             Image img = DBCore.Utility.GetImageFromString(imageData);
             bhikkuImagePicBox.Image = DBCore.Utility.getThumbImage(img, bhikkuImagePicBox.Width, bhikkuImagePicBox.Height);
         }
     }
     catch (Exception ex)
     {
         MessageView.ExceptionError(ex);
     }
 }
예제 #21
0
        private void findButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (UtilityData ut = new UtilityData(true))
                {
                    ut.NameID = NameID;
                    ut.Value  = nameTextBoxX.Text;

                    DataTable ds     = ut.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 1);
                    frmSub.Width = 800;
                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #22
0
        private void findButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (BikkuInfo bInfo = new BikkuInfo(true))
                {
                    bInfo.NIC = nicTextBoxX.Text;
                    bInfo.NameAssumedAtRobing = nameOfAssumedAtRobinTxt.Text;

                    DataTable ds     = bInfo.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 4);
                    frmSub.Width = 800;
                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #23
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            try
            {
                using (User cus = new User(true))
                {
                    cus.ID = userID;

                    if (MessageView.ShowQuestionMsg("Delete user " + fNameTxt.Text + "'") == DialogResult.OK)
                    {
                        cus.Delete();
                        clear();
                        MessageView.ShowMsg("Sucessfully Deleted");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #24
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            try
            {
                using (Item item = new Item(true))
                {
                    item.ID = itemID;

                    if (MessageView.ShowQuestionMsg("Delete Item " + nameTxt.Text + "'") == DialogResult.OK)
                    {
                        item.Delete();
                        clear();
                        MessageView.ShowMsg("Sucessfully Deleted");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #25
0
        private void findButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (Asapuwa asapuwa = new Asapuwa(true))
                {
                    asapuwa.AsapuwaName    = nameTextBoxX.Text;
                    asapuwa.District       = districtCombo.SelectedValue != null ? (int)districtCombo.SelectedValue : 0;
                    asapuwa.ContactNumber1 = tp1textBox.Text;

                    DataTable ds     = asapuwa.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 4, 300, 200);
                    frmSub.Width = 800;
                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #26
0
        private void findButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (MemberInfo mem = new MemberInfo(true))
                {
                    mem.Name    = nameText.Text;
                    mem.Mobile  = mobileText.Text;
                    mem.HomeTP  = homeTpText.Text;
                    mem.Address = "";
                    mem.Email   = "";

                    DataTable ds     = mem.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 3, 50);
                    frmSub.Width = 800;
                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #27
0
        private void findBtn_Click(object sender, EventArgs e)
        {
            try
            {
                using (User user = new User(true))
                {
                    user.Name            = fNameTxt.Text;
                    user.UserName        = usernameTxt.Text;
                    user.Mobile          = mobileTPTxt.Text;
                    user.PermissionLevel = userLevelCombo.SelectedIndex;
                    user.Email           = emailText.Text;

                    DataTable ds     = user.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 3);
                    frmSub.Width = 600;

                    HandleSearch(frmSub);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #28
0
파일: frmMemberNDF.cs 프로젝트: jmkasun/YBS
        private void setPictureFromByteArray(byte[] picData)
        {
            try
            {
                if (picData == null)
                {
                    pictureBox.Image = null;
                    imageData        = null;
                }
                else
                {
                    // set byte array
                    MemoryStream mem = new MemoryStream(picData);
                    imageData = picData;

                    Image img = Image.FromStream(mem);
                    pictureBox.Image = getThumbImage(img);
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }
예제 #29
0
        private bool ValidateBeforeAdd()
        {
            try
            {
                bool result = true;

                // name
                if (string.IsNullOrEmpty(nameTxt.Text))
                {
                    errorProvider1.SetError(nameTxt, "Please Enter Name");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(nameTxt, string.Empty);
                }

                //code
                if (string.IsNullOrEmpty(idTxt.Text))
                {
                    errorProvider1.SetError(idTxt, "Please Enter 'Item Code'");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(idTxt, string.Empty);
                }


                // Cost
                if (costNud.Value == 0)
                {
                    errorProvider1.SetError(costNud, "Please Enter Cost");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(costNud, string.Empty);
                }

                // price
                if (priceNUD.Value == 0)
                {
                    errorProvider1.SetError(priceNUD, "Please Enter Price");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(priceNUD, string.Empty);
                }

                // price
                if (categoryCombo.SelectedValue == null)
                {
                    errorProvider1.SetError(categoryCombo, "Please Enter Category");
                    result = false;
                }
                else
                {
                    errorProvider1.SetError(categoryCombo, string.Empty);
                }

                return(result);
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
                return(false);
            }
        }
예제 #30
0
파일: frmMemberNDF.cs 프로젝트: jmkasun/YBS
        private void findButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (MemberInfo memInfo = new MemberInfo(true, memberType))
                {
                    memInfo.NIC = nicText.Text;

                    if (bloodGroupCombo.SelectedItem == null)
                    {
                        memInfo.BloodGroup = string.Empty;
                    }
                    else
                    {
                        memInfo.BloodGroup = ((ComboItem)bloodGroupCombo.SelectedItem).Text;
                    }

                    memInfo.Name                = nameTextBoxX.Text;
                    memInfo.Mobile              = mobileText.Text;
                    memInfo.HomeTP              = homeTpText.Text;
                    memInfo.Email               = emailText.Text;
                    memInfo.Occupatition        = occuCombo.SelectedValue == null ? -1 : (int)occuCombo.SelectedValue;
                    memInfo.Sex                 = sexCombo.SelectedIndex;
                    memInfo.CivilStatus         = civilStatusCombo.SelectedIndex;
                    memInfo.School              = schoolCombo.SelectedValue == null ? -1 : (int)schoolCombo.SelectedValue;
                    memInfo.EduQualifications   = eduQuaCombo.SelectedValue == null ? -1 : (int)eduQuaCombo.SelectedValue;
                    memInfo.Abilities           = abilityText.Text;
                    memInfo.Contributition      = contribText.Text;
                    memInfo.OtherQualifications = otheQualiText.Text;
                    memInfo.OccupatitioInfo     = occuText.Text;
                    memInfo.Tags                = new List <DBCore.Classes.Tag>();

                    if (tagGrid.Rows.Count > 0)
                    {
                        memInfo.Tags.Add(new Tag((int)tagGrid[2, 0].Value, "", "", 0));
                    }

                    switch (verifiedCheck.CheckState)
                    {
                    case CheckState.Checked:
                    {
                        memInfo.DataVerified = 1;
                        break;
                    }

                    case CheckState.Unchecked:
                    {
                        memInfo.DataVerified = 0;
                        break;
                    }

                    default:
                    {
                        memInfo.DataVerified = -1;
                        break;
                    }
                    }


                    if (indexText.Text == nextIndex)
                    {
                        memInfo.IndexNumber = string.Empty;
                    }
                    else
                    {
                        memInfo.IndexNumber = indexText.Text;
                    }

                    DataTable ds     = memInfo.SelectFind();
                    frmSearch frmSub = new frmSearch(ds, this.Text, 18);

                    frmSub.Width = this.Width - 100;


                    if (HandleSearch(frmSub))
                    {
                        AddFindIDsToList(ds, 20);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
            }
        }