Пример #1
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateBeforeAdd())
                {
                    using (Asapuwa asapuwa = new Asapuwa(true))
                    {
                        asapuwa.AsapuwaName          = nameTextBoxX.Text;
                        asapuwa.ContactNumber1       = tp1textBox.Text;
                        asapuwa.ContactNumber2       = tp2TextBox.Text;
                        asapuwa.Address              = addressTextBox.Text;
                        asapuwa.SangaUpasthayakahimi = 0;     // sangaUpastayakaTheroComboBox.SelectedValue != null ? (int)sangaUpastayakaTheroComboBox.SelectedValue : 0;
                        asapuwa.OpeningDate          = dateOfOpenDtm.Value.Date;
                        asapuwa.HeldUpasampada       = false; // upasampadaCheckBox.Checked;
                        asapuwa.District             = districtCombo.SelectedValue == null ? 0 : (int)districtCombo.SelectedValue;
                        asapuwa.PostalCode           = postalcodeTextbox.Text;
                        asapuwa.Country              = countryCombo.SelectedValue == null ? 0 : countryCombo.Text == "ශ්‍රී ලංකාව" ? 0 : (int)countryCombo.SelectedValue;
                        asapuwa.NumberOfKuti         = (int)numberOfKutiTxt.Value;

                        if (asapuwaID == 0)
                        {
                            if (asapuwa.Add() == 1)
                            {
                                MessageView.ShowMsg("Sucessfully Added");

                                //errorProvider1.SetError(idTxt, string.Empty);
                                //errorProvider1.SetError(nameTxt, string.Empty);

                                clear();
                            }
                        }
                        else
                        {
                            asapuwa.ID = asapuwaID;

                            if (MessageView.ShowQuestionMsg("Update '" + nameTextBoxX.Text + "' Asapuwa") == DialogResult.OK)
                            {
                                if (asapuwa.Update() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Updated");

                                    //errorProvider1.SetError(idTxt, string.Empty);
                                    //errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
Пример #2
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            using (BikkuInfo bInfo = new BikkuInfo(true))
            {
                bInfo.ID = bhikkuID;

                if (MessageView.ShowQuestionMsg("Delete Details for '" + nameOfAssumedAtRobinTxt.Text + "' thero") == DialogResult.OK)
                {
                    bInfo.Delete();
                    clear();
                    MessageView.ShowMsg("Sucessfully Deleted");
                }
            }
        }
Пример #3
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            using (Asapuwa asapuwa = new Asapuwa(true))
            {
                asapuwa.ID = asapuwaID;

                if (MessageView.ShowQuestionMsg("Delete Details for '" + nameTextBoxX.Text + "' Asapuwa") == DialogResult.OK)
                {
                    asapuwa.Delete();
                    clear();
                    MessageView.ShowMsg("Sucessfully Deleted");
                }
            }
        }
Пример #4
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            using (EduQualifications edu = new EduQualifications(true))
            {
                edu.ID = occuID;

                if (MessageView.ShowQuestionMsg("Delete Details of '" + nameTextBoxX.Text + "'") == DialogResult.OK)
                {
                    edu.Delete();
                    clear();
                    MessageView.ShowMsg("Sucessfully Deleted");
                }
            }
        }
Пример #5
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            using (Category sc = new Category(true))
            {
                sc.ID = occuID;

                if (MessageView.ShowQuestionMsg("Delete Details of '" + nameTextBoxX.Text + "'") == DialogResult.OK)
                {
                    sc.Delete();
                    clear();
                    MessageView.ShowMsg("Sucessfully Deleted");
                }
            }
        }
Пример #6
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            using (UtilityData ut = new UtilityData(true))
            {
                ut.ID = ID;

                if (MessageView.ShowQuestionMsg("Delete Details of '" + nameTextBoxX.Text + "'") == DialogResult.OK)
                {
                    ut.Delete();
                    clear();
                    MessageView.ShowMsg("Sucessfully Deleted");
                }
            }
        }
Пример #7
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateBeforeAdd())
                {
                    using (OtherAddress addr = new OtherAddress(true))
                    {
                        setObjectFromFieldValues(addr);

                        if (addressID == 0)
                        {
                            if (addr.Add() == 1)
                            {
                                // MessageView.ShowMsg("Sucessfully Added");

                                //errorProvider1.SetError(idTxt, string.Empty);
                                //errorProvider1.SetError(nameTxt, string.Empty);
                                statusText.Visible = true;
                                timer1.Enabled     = true;

                                clear();
                            }
                        }
                        else
                        {
                            addr.ID = addressID;

                            if (MessageView.ShowQuestionMsg("Update Address") == DialogResult.OK)
                            {
                                if (addr.Update() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Updated");

                                    //errorProvider1.SetError(idTxt, string.Empty);
                                    //errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
Пример #8
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateBeforeAdd())
                {
                    using (UtilityData ut = new UtilityData(true))
                    {
                        ut.NameID = NameID;
                        ut.Value  = nameTextBoxX.Text;

                        if (ID == 0)
                        {
                            if (ut.Add() == 1)
                            {
                                MessageView.ShowMsg("Sucessfully Added");

                                //errorProvider1.SetError(idTxt, string.Empty);
                                //errorProvider1.SetError(nameTxt, string.Empty);

                                clear();
                            }
                        }
                        else
                        {
                            ut.ID = ID;

                            if (MessageView.ShowQuestionMsg("Update ") == DialogResult.OK)
                            {
                                if (ut.Update() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Updated");

                                    //errorProvider1.SetError(idTxt, string.Empty);
                                    //errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
Пример #9
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateBeforeAdd())
                {
                    using (Tag tg = new Tag(true))
                    {
                        tg.Name        = nameTextBoxX.Text;
                        tg.Description = descriptionText.Text;

                        if (occuID == 0)
                        {
                            if (tg.Add() == 1)
                            {
                                MessageView.ShowMsg("Sucessfully Added");

                                //errorProvider1.SetError(idTxt, string.Empty);
                                //errorProvider1.SetError(nameTxt, string.Empty);

                                clear();
                            }
                        }
                        else
                        {
                            tg.ID = occuID;

                            if (MessageView.ShowQuestionMsg("Update School") == DialogResult.OK)
                            {
                                if (tg.Update() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Updated");

                                    //errorProvider1.SetError(idTxt, string.Empty);
                                    //errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
Пример #10
0
        private void savebtn_Click(object sender, EventArgs e)
        {
            SaveToHistry();

            using (ChangeList change = new ChangeList(true))
            {
                change.ID = ChangeListID;

                change.SetAddedHistry();
                AddedHistry = true;

                saveHistrybtn.Enabled = false;
            }

            MessageView.ShowMsg("Sucessfully Saved");
        }
Пример #11
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            using (MemberInfo member = new MemberInfo(true, memberType))
            {
                member.ID = memberID;

                if (MessageView.ShowQuestionMsg("Delete Details of '" + nameTextBoxX.Text + "'") == DialogResult.OK)
                {
                    member.Delete();
                    clear();
                    MessageView.ShowMsg("Sucessfully Deleted");
                }
            }

            SetIndexField();
        }
Пример #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
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateBeforeAdd())
                {
                    using (EduQualifications edu = new EduQualifications(true))
                    {
                        edu.Name = nameTextBoxX.Text;

                        if (occuID == 0)
                        {
                            if (edu.Add() == 1)
                            {
                                MessageView.ShowMsg("Sucessfully Added");

                                //errorProvider1.SetError(idTxt, string.Empty);
                                //errorProvider1.SetError(nameTxt, string.Empty);

                                clear();
                            }
                        }
                        else
                        {
                            edu.ID = occuID;

                            if (MessageView.ShowQuestionMsg("Update EduQualifications") == DialogResult.OK)
                            {
                                if (edu.Update() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Updated");

                                    //errorProvider1.SetError(idTxt, string.Empty);
                                    //errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
Пример #14
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);
            }
        }
Пример #15
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);
            }
        }
Пример #16
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                using (BikkuInfo bInfo = new BikkuInfo(true))
                {
                    if (ValidateBeforeAdd(bInfo))
                    {
                        bInfo.NIC                  = nicTextBoxX.Text;
                        bInfo.SamaneraNumber       = samaneraNumberTextBoxX.Text;
                        bInfo.PassportNumber       = passportNumbrtTextBoxX.Text;
                        bInfo.PlaceOfBirth         = placeOfBirthtxt.Text;
                        bInfo.LayNameInFull        = layNameinFullTxt.Text;
                        bInfo.DateOfBirth          = dobDtm.Value.Date;
                        bInfo.NameOfFatherInFull   = nameOfFatheinFullTxt.Text;
                        bInfo.DateOfRobing         = dateOfRobingDtm.Value.Date;
                        bInfo.NameAssumedAtRobing  = nameOfAssumedAtRobinTxt.Text;
                        bInfo.NameOfRobingTutor    = nameOfRobingTutorCombo.SelectedValue == null ? 0 : (int)nameOfRobingTutorCombo.SelectedValue;
                        bInfo.TempleRobing         = templaRobingTookCombo.SelectedValue == null ? 0 : (int)templaRobingTookCombo.SelectedValue;
                        bInfo.TempleOfResidence    = templaResidenceCombo.SelectedValue == null ? 0 : (int)templaResidenceCombo.SelectedValue;
                        bInfo.NameOfViharadhipathi = nameOfViharadhipathiCombo.SelectedValue == null ? 0 : (int)nameOfViharadhipathiCombo.SelectedValue;

                        bInfo.IsUpasampanna                  = isUpasampannaCheckBox.Checked;
                        bInfo.PlaceOfHigherOrdination        = upasampannaPlaceComboBoxEx.SelectedValue == null ? 0 : (int)upasampannaPlaceComboBoxEx.SelectedValue;
                        bInfo.DateOfHigherOrdination         = upasampannaDatetp.Value.Date;
                        bInfo.NameOfUpadyaAtHigherOrdination = nameofUpadyaComboBoxEx.SelectedValue == null ? 0 : (int)nameofUpadyaComboBoxEx.SelectedValue;
                        bInfo.IsUpadyaThero                  = isUpadyaCheckBox.Checked;
                        //bInfo.Post = isSangaUpasCheckBox.Checked;
                        bInfo.District    = districtcomboBox.SelectedValue == null ? 0 : (int)districtcomboBox.SelectedValue;
                        bInfo.DateOfCame  = dateofCameDtm.Value; // == new DateTime()
                        bInfo.HomeAddress = homeaddressText.Text;
                        bInfo.HomeTP      = hometpText.Text;

                        if (bloodGroupCombo.SelectedItem != null)
                        {
                            ComboItem item = (ComboItem)bloodGroupCombo.SelectedItem;
                            bInfo.BloodGroup = item.Text;
                        }

                        if (bikkuImage == null)
                        {
                            bInfo.ImageData = string.Empty;
                        }
                        else
                        {
                            bInfo.ImageData = Utility.Get64String(bikkuImage);
                        }

                        if (bhikkuID == 0)
                        {
                            setActivitiesToObject(bInfo);
                            setAsapuHistryToObject(bInfo);
                            setOtherDataToObject(bInfo);

                            if (bInfo.Add() == 1)
                            {
                                MessageView.ShowMsg("Sucessfully Added");

                                //errorProvider1.SetError(idTxt, string.Empty);
                                //errorProvider1.SetError(nameTxt, string.Empty);

                                clear();
                            }
                        }
                        else
                        {
                            bInfo.ID = bhikkuID;

                            if (MessageView.ShowQuestionMsg("Update Current Item") == DialogResult.OK)
                            {
                                // if templae changed, ask for add record to histry
                                if (TempleOfResidenceBeforeChange != bInfo.TempleOfResidence)
                                {
                                    string message = string.Concat("<br/><br/><b>Asapuwa&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;</b>", TempleOfResidenceBeforeChangeName, "\r\n<br/><b>From Date&nbsp;&nbsp;:&nbsp;</b>", histryDatagrid.Rows[histryDatagrid.RowCount - 1].Cells[4].Value, "\r\n<br/><b>To Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;</b>", DateTime.Now.ToString("yyyy-MMM-dd"));
                                    if (MessageView.ShowQuestionMsg("Residence temple has edited, Add histry record? \n\n" + message) == System.Windows.Forms.DialogResult.OK)
                                    {
                                    }
                                }


                                if (bInfo.Update() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Updated");

                                    //errorProvider1.SetError(idTxt, string.Empty);
                                    //errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
Пример #17
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                using (MemberInfo memInfo = new MemberInfo(true, memberType))
                {
                    if (ValidateBeforeAdd(memInfo))
                    {
                        memInfo.NIC                 = nicText.Text;
                        memInfo.BloodGroup          = bloodGroupCombo.Text;
                        memInfo.Name                = nameTextBoxX.Text;
                        memInfo.Address             = addressTextbox.Text;
                        memInfo.DOB                 = dobDate.Value.Date;
                        memInfo.Mobile              = mobileText.Text;
                        memInfo.HomeTP              = homeTpText.Text;
                        memInfo.Email               = emailText.Text;
                        memInfo.Occupatition        = occuCombo.SelectedValue == null ? -1 : (int)occuCombo.SelectedValue;
                        memInfo.OccupatitioInfo     = occuText.Text;
                        memInfo.DOJoinAsapuwa       = dojoindate.Value.Date;
                        memInfo.Abilities           = abilityText.Text;
                        memInfo.Contributition      = contribText.Text;
                        memInfo.IndexNumber         = indexText.Text;
                        memInfo.School              = schoolCombo.SelectedValue == null ? -1 : (int)schoolCombo.SelectedValue;
                        memInfo.EduQualifications   = eduQuaCombo.SelectedValue == null ? -1 : (int)eduQuaCombo.SelectedValue;
                        memInfo.OtherQualifications = otheQualiText.Text;
                        memInfo.DataVerified        = verifiedCheck.Checked ? 1 : 0;


                        if (bloodGroupCombo.SelectedItem != null)
                        {
                            ComboItem item = (ComboItem)bloodGroupCombo.SelectedItem;
                            memInfo.BloodGroup = item.Text;
                        }

                        memInfo.Sex         = sexCombo.SelectedIndex;
                        memInfo.CivilStatus = civilStatusCombo.SelectedIndex;

                        if (imageData == null)
                        {
                            memInfo.ImageData = string.Empty;
                        }
                        else
                        {
                            memInfo.ImageData = Utility.Get64String(imageData);
                        }


                        if (memberID == 0)
                        {
                            addTagsToObject(memInfo);

                            if (memInfo.Add() == 1)
                            {
                                MessageView.ShowMsg("Sucessfully Added");

                                nextIndex = memInfo.GetNextIndex();

                                clear();
                            }
                        }
                        else
                        {
                            memInfo.ID = memberID;

                            if (MessageView.ShowQuestionMsg("Update Member info") == DialogResult.OK)
                            {
                                if (memInfo.Update() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Updated");

                                    //errorProvider1.SetError(idTxt, string.Empty);
                                    //errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                            }
                        }
                    }
                }

                // SetIndexField();
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
Пример #18
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateBeforeAdd())
                {
                    using (Item item = new Item(true))
                    {
                        item.Name         = nameTxt.Text;
                        item.Code         = idTxt.Text;
                        item.Cost         = (double)costNud.Value;
                        item.Price        = (double)priceNUD.Value;
                        item.InStock      = (int)inStockNUD.Value;
                        item.WarnLimit    = (int)warnLimitNUD.Value;
                        item.MainCategory = (int)categoryCombo.SelectedValue;
                        item.SubCategory  = subcategoryCombo.SelectedValue == null ? 0 : (int)subcategoryCombo.SelectedValue;
                        item.CustomPrice  = customPriceCheckbox.Checked;

                        if (itemID == 0)
                        {
                            int status = item.SelectExists();

                            switch (status)
                            {
                            case 0:
                                if (item.Add() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Added");

                                    errorProvider1.SetError(idTxt, string.Empty);
                                    errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                                break;

                            case 1:
                                errorProvider1.SetError(idTxt, "'Item Code' Already Exists");
                                break;

                            case 2:
                                errorProvider1.SetError(nameTxt, "'Name' Already Exists");

                                break;

                            case 3:
                                errorProvider1.SetError(nameTxt, "'Name' Already Exists");
                                errorProvider1.SetError(idTxt, "'Item Code' Already Exists");
                                break;
                            }
                        }
                        else
                        {
                            item.ID = itemID;

                            if (MessageView.ShowQuestionMsg("Update Current Item") == DialogResult.OK)
                            {
                                if (item.Update() == 1)
                                {
                                    MessageView.ShowMsg("Sucessfully Updated");

                                    errorProvider1.SetError(idTxt, string.Empty);
                                    errorProvider1.SetError(nameTxt, string.Empty);

                                    clear();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }