コード例 #1
0
 private void buttonItem8_Click(object sender, EventArgs e)
 {
     if (MessageView.ShowQuestionMsg("Close Application ?") == System.Windows.Forms.DialogResult.OK)
     {
         Application.Exit();
     }
 }
コード例 #2
0
 private void cancelbtn_Click(object sender, EventArgs e)
 {
     if (MessageView.ShowQuestionMsg("Clear Data") == DialogResult.OK)
     {
         clear();
     }
 }
コード例 #3
0
        private void otherDatagrid_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (otherDatagrid.CurrentRow.Index > -1)
            {
                byte[] fileData = null;
                string fileName = otherDatagrid.Rows[otherDatagrid.CurrentRow.Index].Cells[2].Value.ToString();

                if (MessageView.ShowQuestionMsg("Download File '" + fileName + "' ?") == System.Windows.Forms.DialogResult.OK)
                {
                    saveFileDialog1.FileName = fileName;
                    if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        int id = (int)otherDatagrid.Rows[otherDatagrid.CurrentRow.Index].Cells[0].Value;
                        using (BikkuInfo bInfo = new BikkuInfo(true))
                        {
                            fileData = bInfo.GetOtherDatafile(id);
                        }


                        if (fileData != null)
                        {
                            File.WriteAllBytes(saveFileDialog1.FileName, Utility.DecompressGZip(fileData));
                        }
                    }
                }
            }
        }
コード例 #4
0
        private void AddUpdate()
        {
            try
            {
                using (MemberInfo memInfo = new MemberInfo(true))
                {
                    if (ValidateBeforeAdd(memInfo))
                    {
                        memInfo.Name             = nameTextBoxX.Text;
                        memInfo.Address          = addressTextbox.Text;
                        memInfo.Mobile           = mobileText.Text;
                        memInfo.HomeTP           = homeTpText.Text;
                        memInfo.Email            = emailText.Text;
                        memInfo.regNumber        = indexText.Text;
                        memInfo.DataVerified     = verifiedCheck.Checked ? 1 : 0;
                        memInfo.Amount           = (int)amountTxt.Value;
                        memInfo.bank             = (DBCore.Banks)bankCombo.SelectedIndex + 1;
                        memInfo.paymentType      = (DBCore.PaymentType)paymentTypeCombo.SelectedIndex + 1;
                        memInfo.subscriptionType = (DBCore.SubscriptionType)subscriptionTypeCombo.SelectedIndex + 1;
                        memInfo.nameInMag        = nameInmagText.Text;
                        memInfo.numOfMagazine    = (int)numOfMag.Value;
                        memInfo.Note             = note;

                        addAddressToObject(memInfo);

                        if (memberID == 0)
                        {
                            if (memInfo.Add() == 1)
                            {
                                ShowStatus("Successfully Added");
                                nextIndex = memInfo.GetNextIndex();

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

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

                                    clear();
                                }
                            }
                        }
                    }
                }

                // SetIndexField();
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
コード例 #5
0
ファイル: frmMemberNDF.cs プロジェクト: jmkasun/YBS
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     if (MessageView.ShowQuestionMsg("Delete Image") == DialogResult.OK)
     {
         pictureBox.Image = null;
         imageData        = null;
     }
 }
コード例 #6
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);
            }
        }
コード例 #7
0
ファイル: frmCategory.cs プロジェクト: jmkasun/DharmaDaana
        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");
                }
            }
        }
コード例 #8
0
ファイル: frmUtilityData.cs プロジェクト: jmkasun/mInfo
        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");
                }
            }
        }
コード例 #9
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");
                }
            }
        }
コード例 #10
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");
                }
            }
        }
コード例 #11
0
ファイル: frmEduQualification.cs プロジェクト: jmkasun/YBS
        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");
                }
            }
        }
コード例 #12
0
ファイル: frmAddress.cs プロジェクト: jmkasun/DharmaDaana
        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);
            }
        }
コード例 #13
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);
            }
        }
コード例 #14
0
ファイル: frmUtilityData.cs プロジェクト: jmkasun/mInfo
        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);
            }
        }
コード例 #15
0
ファイル: frmMemberNDF.cs プロジェクト: jmkasun/YBS
        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();
        }
コード例 #16
0
ファイル: frmMemberNDF.cs プロジェクト: jmkasun/YBS
        private void tagGrid_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete && tagGrid.CurrentRow.Index > -1)
            {
                if (MessageView.ShowQuestionMsg("Delete Current Tag '" + tagGrid.Rows[tagGrid.CurrentRow.Index].Cells[1].Value + "' ?") == System.Windows.Forms.DialogResult.OK)
                {
                    int id = (int)tagGrid.Rows[tagGrid.CurrentRow.Index].Cells[0].Value;
                    using (MemberInfo mem = new MemberInfo(true, memberType))
                    {
                        mem.RemoveMemberTag(id);
                    }

                    tagGrid.Rows.RemoveAt(tagGrid.CurrentRow.Index);
                }
            }
        }
コード例 #17
0
ファイル: frmEduQualification.cs プロジェクト: jmkasun/YBS
        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);
            }
        }
コード例 #18
0
ファイル: frmUser.cs プロジェクト: jmkasun/DharmaDaana
        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);
            }
        }
コード例 #19
0
        void lbl_MouseClick(object sender, MouseEventArgs e)
        {
            ChangeListHistryLabel lbl = ((ChangeListHistryLabel)sender);

            if (e.X > lbl.Width - 20)
            {
                if (MessageView.ShowQuestionMsg("Delete Item") == DialogResult.OK)
                {
                    using (ChangeList c = new ChangeList(true))
                    {
                        c.ID = lbl.ChangeList.ID;
                        c.Delete();
                        ReloadhistryLabels();
                    }
                }
            }
        }
コード例 #20
0
ファイル: frmChangeRequest.cs プロジェクト: jmkasun/mInfo
 private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
 {
     if (MessageView.ShowQuestionMsg("Delete Record") == DialogResult.OK)
     {
         using (ChangelistRequest r = new ChangelistRequest(true))
         {
             if (r.Delete(Convert.ToInt32(e.Row.Cells[0].Value)) == 0)
             {
                 e.Cancel = true;
             }
         }
     }
     else
     {
         e.Cancel = true;
     }
 }
コード例 #21
0
 private void frmChangeList_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (saveHistrybtn.Enabled)
     {
         if (MessageView.ShowQuestionMsg("Changes are not saved to bhikku histry\nClose without saving histry?") == System.Windows.Forms.DialogResult.No)
         {
             e.Cancel = true;
             return;
         }
     }
     else
     {
         if (MessageView.ShowQuestionMsg("Close Window") == System.Windows.Forms.DialogResult.No)
         {
             e.Cancel = true;
         }
     }
 }
コード例 #22
0
        private void otherDatagrid_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete && otherDatagrid.CurrentRow.Index > -1)
            {
                if (MessageView.ShowQuestionMsg("Delete Current Data ?") == System.Windows.Forms.DialogResult.OK)
                {
                    int id = (int)otherDatagrid.Rows[otherDatagrid.CurrentRow.Index].Cells[0].Value;
                    using (BikkuInfo bInfo = new BikkuInfo(true))
                    {
                        bInfo.RemoveOtherData(id);
                    }

                    otherDatagrid.Rows.RemoveAt(otherDatagrid.CurrentRow.Index);

                    Utility.SetDatagridViewRow(otherDatagrid);
                }
            }
        }
コード例 #23
0
ファイル: frmUser.cs プロジェクト: jmkasun/DharmaDaana
        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 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);
            }
        }
コード例 #26
0
        private void addbtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateBeforeAdd())
                {
                    if (paymentID == 0 && monthlyAmount > 0)
                    {
                        int numberofMonths = (int)amountText.Value / monthlyAmount;
                        for (int i = 0; i < numberofMonths; i++)
                        {
                            using (MonthlyPayment pay = new MonthlyPayment(true))
                            {
                                setObjectFromFieldValues(pay, i);

                                if (pay.MemberID > 0 && pay.Add() == 1)
                                {
                                    // MessageView.ShowMsg("Sucessfully Added");

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

                        clear(1);
                    }
                    else if (memberID > 0)
                    {
                        using (MonthlyPayment pay = new MonthlyPayment(true))
                        {
                            pay.ID = paymentID;
                            setObjectFromFieldValues(pay, 0);

                            if (MessageView.ShowQuestionMsg("Update record") == DialogResult.OK)
                            {
                                if (pay.Update() == 1)
                                {
                                    SetHistryGrid(pay.GetPaymentHistry());

                                    extraAmountNum.Value = 0;
                                }
                            }
                        }
                    }
                }
            }
            //  catch()
            catch (Exception ex)
            {
                if (ex.Message.StartsWith("Duplicate entry"))
                {
                    MessageView.ShowErrorMsg("Already Added");
                }
                else
                {
                    MessageView.ShowErrorMsg(ex.Message);
                }
            }
        }
コード例 #27
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);
            }
        }
コード例 #28
0
ファイル: frmMemberNDF.cs プロジェクト: jmkasun/YBS
        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);
            }
        }