コード例 #1
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));
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: frm_CustomReport.cs プロジェクト: jmkasun/mInfo
 private void button1_Click(object sender, EventArgs e)
 {
     using (BikkuInfo b = new BikkuInfo(true))
     {
         this.dataGridView1.DataSource = b.SelectBhikkuCustomReport(1);
     }
 }
コード例 #3
0
        private void LoadBhikkuDetails()
        {
            using (BikkuInfo bInfo = new BikkuInfo(true))
            {
                bInfo.SelectBhikkuChangeList(this.bInfo.ID);

                ChangeListItemBhikkuDetails bDetails = new ChangeListItemBhikkuDetails(bInfo, this.Parent.Parent.Parent.Parent.Controls, new Point(MousePosition.X, MousePosition.Y - 45) /*new Point(this.Location.X+this.Width,this.Location.Y + this.Height)*/);
            }
        }
コード例 #4
0
        public void AddData(BikkuInfo b)
        {
            mahamevnainfoDataSet.BhikkuReport.Rows.Clear();

            mahamevnainfoDataSet.BhikkuReport.Rows.Add(b.NameAssumedAtRobing, b.NIC, b.SamaneraNumber,
                                                       b.UpasampadaNumber, b.BloodGroup, b.HomeAddress, b.HomeTP + (string.IsNullOrEmpty(b.HomeTP2) ? "" : " / " + b.HomeTP2), b.PassportNumber,
                                                       b.DateOfBirth == new DateTime() ? "" : b.DateOfBirth.ToString("yyy-MMM-dd"),
                                                       b.DateOfRobing == new DateTime() ? "" : b.DateOfRobing.ToString("yyy-MMM-dd"),
                                                       "", b.ImageData);
        }
コード例 #5
0
        private void rptBhikkuReport_Load(object sender, EventArgs e)
        {
            using (BikkuInfo bInfo = new BikkuInfo(true))
            {
                bInfo.BindToComboNameSeparate(nameOfAssumedAtRobinCombo);
            }
            nameOfAssumedAtRobinCombo.SelectedIndex = -1;

            //this.reportViewer1.RefreshReport();
        }
コード例 #6
0
ファイル: rptBhikkuStatus.cs プロジェクト: jmkasun/mInfo
        private void showbtn_Click(object sender, EventArgs e)
        {
            using (BikkuInfo b = new BikkuInfo(true))
            {
                CurrenStatus sts = sitiRadio.Checked ? CurrenStatus.Siti : otherPlaceRadio.Checked ? CurrenStatus.OtherPlace : upavidiRadio.Checked ? CurrenStatus.Upavidi : CurrenStatus.Apawath;

                AddData(b.SelectAllList(sts));
            }
            this.reportViewer1.RefreshReport();
        }
コード例 #7
0
ファイル: rpt_AllbhikkuAsapuwa.cs プロジェクト: jmkasun/mInfo
        private void rptNameIDReport_Load(object sender, EventArgs e)
        {
            using (BikkuInfo b = new BikkuInfo(true))
            {
                //CurrenStatus sts = sitiRadio.Checked ? CurrenStatus.Siti : otherPlaceRadio.Checked ? CurrenStatus.OtherPlace : CurrenStatus.Upavidi;

                AddData(b.SelectAllListWithAsapuwa());
            }
            this.reportViewer1.RefreshReport();
        }
コード例 #8
0
        private void setActivitiesToObject(BikkuInfo bInfo)
        {
            bInfo.Activities = new List <Activity>();

            if (activityDatagrid.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in activityDatagrid.Rows)
                {
                    bInfo.Activities.Add(new Activity(0, row.Cells[0].Value.ToString()));
                }
            }
        }
コード例 #9
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");
                }
            }
        }
コード例 #10
0
        private void showbtn_Click(object sender, EventArgs e)
        {
            if (nameOfAssumedAtRobinCombo.SelectedValue == null)
            {
                return;
            }

            using (BikkuInfo b = new BikkuInfo(true))
            {
                b.ID = (int)nameOfAssumedAtRobinCombo.SelectedValue;
                AddData(b.SelectBhikkuReport());
            }
            this.reportViewer1.RefreshReport();
        }
コード例 #11
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);
            }
        }
コード例 #12
0
        private void setAsapuHistryToObject(BikkuInfo bInfo)
        {
            bInfo.AsapuHistry = new List <BhikkuAsapuHistry>();

            if (histryDatagrid.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in histryDatagrid.Rows)
                {
                    DateTime fromDate = DateTime.Parse(row.Cells[3].Value.ToString());
                    DateTime toDate   = DateTime.Parse(row.Cells[4].Value.ToString());

                    bInfo.AsapuHistry.Add(new BhikkuAsapuHistry(0, (int)row.Cells[1].Value, fromDate, toDate, "", DBCore.BhikkuPost.NAN, ""));
                }
            }
        }
コード例 #13
0
        private void setOtherDataToObject(BikkuInfo bInfo)
        {
            bInfo.OtherData = new List <OtherData>();

            if (otherDatagrid.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in otherDatagrid.Rows)
                {
                    //DateTime fromDate = DateTime.Parse(row.Cells[3].Value.ToString());
                    //DateTime toDate = DateTime.Parse(row.Cells[4].Value.ToString());

                    bInfo.OtherData.Add(new OtherData(0, row.Cells[1].Value.ToString(), row.Cells[2].Value.ToString(), (byte[])row.Cells[4].Value));
                }
            }
        }
コード例 #14
0
        private void AddBhikkLabels(object maxNamelength)
        {
            BhikkuDict = new Dictionary <int, ChangeListItemBhikku>();

            Dictionary <int, string> crList = null;

            using (ChangelistRequest cr = new ChangelistRequest(true))
            {
                crList = cr.SelectBhikkuAsapuwanme(ChangeListID);
            }


            foreach (string name in bhikkuList.Keys)
            {
                BikkuInfo bInfo = bhikkuList[name];
                string    requestedAsapuNames = string.Empty;

                if (crList.ContainsKey(bInfo.ID))
                {
                    requestedAsapuNames = crList[bInfo.ID];
                }

                BhikkuDict.Add(bInfo.ID, new ChangeListItemBhikku(name, bhikkuNamelistPanel, bInfo, (int)maxNamelength, new AddDeleteChangeItem(AddDeleteChangeItem), requestAsapuTooltip, requestedAsapuNames));



                if (bInfo.IsUpasampanna)
                {
                    upasampadaCount++;
                }
                else
                {
                    samaneraCount++;
                }

                currentPanelCount++;

                if (currentPanelCount == 300)
                {
                    bhikkuNamelistPanel = createBhikkuPanel();
                    currentPanelCount   = 0;
                }
            }

            upasampadaountLb.Text = upasampadaCount.ToString();
            samaneraCountLbl.Text = samaneraCount.ToString();
        }
コード例 #15
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);
                }
            }
        }
コード例 #16
0
        private void activityButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(activityTextbox.Text))
            {
                if (bhikkuID != 0)
                {
                    using (BikkuInfo info = new BikkuInfo(true))
                    {
                        info.ID = bhikkuID;

                        info.AddActivity(activityTextbox.Text);
                    }
                }

                AddActivityRow(0, activityTextbox.Text);

                activityTextbox.Clear();
            }
        }
コード例 #17
0
        private void addHistryButton_Click(object sender, EventArgs e)
        {
            if (validateAsapuHistry())
            {
                if (bhikkuID != 0)
                {
                    using (BikkuInfo info = new BikkuInfo(true))
                    {
                        info.ID = bhikkuID;
                        info.AddAsapuHistry((int)asapuHistrAsapu.SelectedValue, asapuHistryFrom.Value.Date, asapuHistryTo.Value.Date, DBCore.BhikkuPost.NAN, "");
                    }
                }

                AddAsapuhistryRow(0, (int)asapuHistrAsapu.SelectedValue, asapuHistrAsapu.Text, asapuHistryFrom.Value.Date, asapuHistryTo.Value.Date);

                asapuHistrAsapu.SelectedIndex = -1;
                asapuHistryFrom.Value         = DateTime.Now;
                asapuHistryTo.Value           = DateTime.Now;
            }
        }
コード例 #18
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);
            }
        }
コード例 #19
0
        public ChangeListItemBhikkuPlanel(string text, Control.ControlCollection contralls, BikkuInfo bInfo, int width)
        {
            this.bInfo = bInfo;


            this.Text     = "       " + text;
            this.Size     = new System.Drawing.Size(width, 25);
            this.Location = new System.Drawing.Point(5, (contralls.Count * this.Height) + (contralls.Count * 2) + 8);
            this.Font     = new System.Drawing.Font(this.Font.FontFamily, 11);
            //this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            contralls.Add(this);

            this.MouseEnter += new EventHandler(ChangeListLabel_MouseEnter);
            this.MouseLeave += new EventHandler(ChangeListLabel_MouseLeave);
            this.MouseDown  += new MouseEventHandler(label_MouseDown);

            this.ContextMenu = CreateContextMenuItems();

            SetOriginalColor();
            InitializeComponent();
        }
コード例 #20
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //validate
            if (pwdText.Text != repwdtext.Text)
            {
                errorProvider1.SetError(repwdtext, "Re-Password Not Match");
                return;
            }

            // reset error provider
            errorProvider1.SetError(repwdtext, "");

            // create password file
            DBCore.Utility.CreateDBPassword(pwdText.Text);

            /// test connection with current password
            try
            {
                using (BikkuInfo bInfo = new BikkuInfo(true))
                {
                    bInfo.SelectBhikku(-1);
                }

                this.Close();
            }
            catch (Exception ex)
            {
                // reset connectionstring
                DBCore.Utility.ConnectionString = string.Empty;
                if (File.Exists(DBCore.Utility.DBConfigDataFile))
                {
                    File.Delete(DBCore.Utility.DBConfigDataFile);
                }

                pwdText.Focus();


                MessageBox.Show("Invalied Usename\n" + ex.Message);
            }
        }
コード例 #21
0
ファイル: frmChangeRequest.cs プロジェクト: jmkasun/mInfo
        private void frmChangeRequest_Load(object sender, EventArgs e)
        {
            using (ChangeList cLIst = new ChangeList(true))
            {
                cLIst.BindToCombo(cmbChangeList);
            }

            using (BikkuInfo b = new BikkuInfo(true))
            {
                b.BindToComboNameSeparate(cmbName);
                cmbName.SelectedIndex = -1;
            }

            using (Asapuwa a = new Asapuwa(true))
            {
                a.BindToCombo(new ComboBox[] { requestAsapuwa1, requestAsapuwa2, requestAsapuwa3 });
            }

            finishLoadData = true;

            refreshData();
        }
コード例 #22
0
        private void addInfoBtn_Click(object sender, EventArgs e)
        {
            if (validateOtherData())
            {
                string fileName = Path.GetFileName(imageName.Text);
                if (bhikkuID != 0)
                {
                    using (BikkuInfo info = new BikkuInfo(true))
                    {
                        info.ID = bhikkuID;


                        info.AddOtherData(descriptionTxt.Text, fileName, Utility.GetFileByteCompress(fileName));
                    }
                }

                AddOtherDataRow(0, descriptionTxt.Text, fileName, Utility.GetFileByteCompress(fileName));

                imageName.Clear();
                descriptionTxt.Clear();
            }
        }
コード例 #23
0
        private void SaveToHistry()
        {
            using (ChangeList cList = new ChangeList(true))
            {
                cList.ID = ChangeListID;
                cList.DeleteBhikkuHistry();
            }


            using (BikkuInfo bInfo = new BikkuInfo(true))
            {
                foreach (int key in AsapuDict.Keys)
                {
                    ChangeListItemAsapuwa a = AsapuDict[key];

                    foreach (ChangeListItemBhikku b in a.bhikkuList)
                    {
                        bInfo.ID = b.bInfo.ID;
                        bInfo.AddAsapuHistry(a.asapuwaID, FromDate, ToDate, b.bInfo.Post, "", ChangeListID);
                    }
                }
            }
        }
コード例 #24
0
        private void frmChangeList_Load(object sender, EventArgs e)
        {
            int maxNameLength = 0;



            using (BikkuInfo bInfo = new BikkuInfo(true))
            {
                bhikkuList = bInfo.SelectAllDictionary(ref maxNameLength);
                bInfo.BindToComboNameSeparate(nameOfAssumedAtRobinCombo);
            }



            bhikkuNamelistPanel = createBhikkuPanel();



            AddBhikkLabels((int)(maxNameLength * 11));

            using (Asapuwa asp = new Asapuwa(true))
            {
                asapuwaList = asp.SelectAllDictionary(ref maxNameLength);
                asp.BindToCombo(asapuHistrAsapu);
            }

            AddAsapuListRclick((int)(maxNameLength * 8));



            this.WindowState = FormWindowState.Maximized;
            this.nameOfAssumedAtRobinCombo.SelectedValueChanged += new System.EventHandler(this.nameOfAssumedAtRobinCombo_SelectedValueChanged);

            label5.BackColor = upasampadaountLb.BackColor = upasampadaChangeCountLbl.BackColor = upasampadaRemainCountLbl.BackColor = Utility.GetBhikkuLabelColor(DBCore.BhikkuType.Upasampada);
            label6.BackColor = samaneraCountLbl.BackColor = samaneraChangeCountLbl.BackColor = samaneraRemainCountLbl.BackColor = Utility.GetBhikkuLabelColor(DBCore.BhikkuType.Samanera);
        }
コード例 #25
0
        public ChangeListItemBhikku(string text, Panel panel, BikkuInfo bInfo, int width, AddDeleteChangeItem addChangeItemTable, System.Windows.Forms.ToolTip _requestAsapuTooltip, string _requestedAsapuNames)
        {
            try
            {
                this.bInfo          = bInfo;
                RequestAsapuTooltip = _requestAsapuTooltip;
                RequestedAsapuNames = _requestedAsapuNames;
                AddChangeItemTable  = addChangeItemTable;

                this.Size     = new System.Drawing.Size(width + 80, 68);
                this.Location = new System.Drawing.Point(5, (panel.Controls.Count * this.Height) + (panel.Controls.Count * 2) + 20);
                this.Font     = new System.Drawing.Font(this.Font.FontFamily, 13, FontStyle.Bold);
                //this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;

                this.ContextMenu = CreateContextMenuItems();



                InitializeComponent();

                this.BodyButton.MouseEnter += new EventHandler(ChangeListLabel_MouseEnter);
                this.BodyButton.MouseLeave += new EventHandler(ChangeListLabel_MouseLeave);
                this.BodyButton.MouseDown  += new MouseEventHandler(label_MouseDown);

                this.HeadButton.MouseEnter += new EventHandler(ChangeListLabel_MouseEnter);
                this.HeadButton.MouseLeave += new EventHandler(ChangeListLabel_MouseLeave);
                this.HeadButton.MouseDown  += new MouseEventHandler(label_MouseDown);

                this.RearButton.MouseEnter += new EventHandler(ChangeListLabel_MouseEnter);
                this.RearButton.MouseLeave += new EventHandler(ChangeListLabel_MouseLeave);
                this.RearButton.MouseDown  += new MouseEventHandler(label_MouseDown);

                if (string.IsNullOrEmpty(bInfo.ImageData))
                {
                    imagePicbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                }
                else
                {
                    imagePicbox.BorderStyle = System.Windows.Forms.BorderStyle.None;
                    Utility.setBhikkuPictureFromByteArray(DBCore.Utility.GetByteFrom64String(bInfo.ImageData), imagePicbox);
                }


                setOriginalImage(bInfo.BhikkuType, bInfo.ChangeType, false, isDraged);

                this.Controls.Add(imagePicbox);
                this.Controls.Add(BodyButton);
                this.Controls.Add(HeadButton);
                this.Controls.Add(RearButton);


                HeadButton.Location  = new Point(0, 20);
                imagePicbox.Location = new Point(30, 0);
                BodyButton.Location  = new Point(98, 20);

                BodyButton.Size = new System.Drawing.Size(this.Width - HeadButton.Width - RearButton.Width - imagePicbox.Width + 3, 30);

                RearButton.Location = new Point(98 + BodyButton.Width, 20);
                RearButton.BringToFront();

                BodyButton.Text = text;

                if (!string.IsNullOrEmpty(RequestedAsapuNames))
                {
                    BodyButton.ForeColor = Color.FromArgb(0, 0, 80);
                }

                AddObjectTopanel(panel, this);
                toolTipParent = this.Parent.Parent.Parent.Parent.Parent.Parent;
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message);
            }
        }
コード例 #26
0
        public ChangeListItemBhikkuDetails(BikkuInfo binfo, Control.ControlCollection Control, Point location)
        {
            this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.AllowDrop   = true;
            this.DragEnter  += new DragEventHandler(panel_DragEnter);

            this.Visible = false;
            this.Visible = true;

            // name label
            nameLabel                 = new Label();
            nameLabel.Text            = binfo.NameAssumedAtRobing;
            nameLabel.Location        = new Point(5, 2);
            nameLabel.Font            = new System.Drawing.Font(nameLabel.Font.FontFamily, 10, FontStyle.Bold);
            nameLabel.AutoSize        = true;
            nameLabel.BackColor       = Color.Transparent;
            this.nameLabel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel_MouseDown);
            this.nameLabel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel_MouseMove);
            this.nameLabel.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.panel_MouseUp);


            if (this.Width < nameLabel.PreferredWidth + 30)
            {
                this.Width = nameLabel.PreferredWidth + 30;
            }

            // last
            InitializeComponent();
            this.closeButton.Location = new System.Drawing.Point(this.Size.Width - this.closeButton.Size.Width - 3, 1);
            this.pictureBox1.Location = new System.Drawing.Point(this.Size.Width - this.pictureBox1.Size.Width, this.Size.Height - this.pictureBox1.Size.Height);
            this.captionPanel.Width   = this.Width;

            this.CanvasColor      = System.Drawing.SystemColors.Control;
            this.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            this.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
            this.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
            this.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
            this.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
            this.Style.ForeColor.ColorSchemePart   = DevComponents.DotNetBar.eColorSchemePart.PanelText;
            this.Style.GradientAngle = 90;

            this.captionPanel.Controls.Add(nameLabel);
            this.captionPanel.BringToFront();
            this.closeButton.BringToFront();
            this.pictureBox1.Cursor = System.Windows.Forms.Cursors.SizeNWSE;

            Control.Add(this);

            //if (location.Y + this.Height > this.TopLevelControl.Height)
            //{
            //    this.Location = new Point(location.X, 250);
            //}
            //else
            //{
            this.Location = new Point(location.X - 50, 150);
            //}

            this.BringToFront();

            setBhikkuPictureFromByteArray(binfo.ImageData);
            this.Controls.Add(bhikkuImagePicBox);
            this.bhikkuImagePicBox.Location = new Point(this.Width - bhikkuImagePicBox.Width - 5, 28);

            numberLabel.Location      = new Point(5, 40);
            numberValueLabel.Location = new Point(140, 40);
            numberValueLabel.Text     = string.Concat(":     ", binfo.Number.ToString());

            langCaption.Location      = new Point(5, 70);
            langCaptionValue.Location = new Point(80, 70);

            string langs = "";

            if (binfo.Hindhi)
            {
                langs = string.Concat(langs, ", හින්දි");
            }
            if (binfo.English)
            {
                langs = string.Concat(langs, ", ඉංග්‍රීසි");
            }
            if (binfo.Tamil)
            {
                langs = string.Concat(langs, ", දෙමළ");
            }

            foreach (UtilityData ud in binfo.OtherLanguages)
            {
                langs = string.Concat(langs, ", ", ud.Value);
            }

            if (langs.Length > 1)
            {
                langCaptionValue.Text = langs.Substring(1);
            }

            //idLabel.Location = new Point(5, 100);
            //idValueLabel.Location = new Point(140, 100);
            //idValueLabel.Text = string.Concat(":     ", binfo.NIC);

            this.Controls.Add(numberLabel);
            this.Controls.Add(numberValueLabel);
            this.Controls.Add(samaneranUmberLabel);
            this.Controls.Add(samaneraNumberValueLabel);
            this.Controls.Add(idLabel);
            this.Controls.Add(idValueLabel);
            this.Controls.Add(langCaption);
            this.Controls.Add(langCaptionValue);

            SetHistryGrid(binfo.AsapuHistry);
            this.Controls.Add(histryHrid);
            this.histryHrid.Location = new Point(2, 190);
            this.histryHrid.BringToFront();

            this.Controls.Add(activityGrid);
            this.activityGrid.Location = new Point(2, 90);
            SetActivityGrid(binfo.Activities);
            this.BringToFront();
        }
コード例 #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
        private bool ValidateBeforeAdd(BikkuInfo binfo)
        {
            try
            {
                bool retVal = true;

                int nicIndexValidator = binfo.ValidateIndexNICNumbers(nicTextBoxX.Text, samaneraNumberTextBoxX.Text, bhikkuID);


                if (string.IsNullOrEmpty(samaneraNumberTextBoxX.Text))
                {
                    errorProvider1.SetError(samaneraNumberTextBoxX, "Samanera Number cannot be empty");
                    retVal = false;
                    changeTabCaptionColor(0, true);
                }
                else
                {
                    if ((nicIndexValidator == 4 || nicIndexValidator == 3))
                    {
                        errorProvider1.SetError(samaneraNumberTextBoxX, "Duplicate Samanera number");
                        retVal = false;
                        changeTabCaptionColor(0, true);
                    }
                    else
                    {
                        errorProvider1.SetError(samaneraNumberTextBoxX, string.Empty);
                        changeTabCaptionColor(0, false);
                    }
                }


                // name
                if (string.IsNullOrEmpty(nameOfAssumedAtRobinTxt.Text))
                {
                    errorProvider1.SetError(nameOfAssumedAtRobinTxt, "Please Enter Name");
                    retVal = false;
                    changeTabCaptionColor(0, true);
                }
                else
                {
                    errorProvider1.SetError(nameOfAssumedAtRobinTxt, string.Empty);
                    changeTabCaptionColor(0, false);
                }


                if (!string.IsNullOrEmpty(nicTextBoxX.Text) && nicTextBoxX.Text.Length != 10)
                {
                    errorProvider1.SetError(nicTextBoxX, "Invalied 'NIC'");
                    changeTabCaptionColor(2, true);
                    retVal = false;
                }
                else
                {
                    double nicInt = 0;

                    if (!string.IsNullOrEmpty(nicTextBoxX.Text) && nicTextBoxX.Text.Length == 10)
                    {
                        if (double.TryParse(nicTextBoxX.Text.Substring(0, 9), out nicInt) && !double.TryParse(nicTextBoxX.Text.Substring(9, 1), out nicInt))
                        {
                            if (!string.IsNullOrEmpty(nicTextBoxX.Text) && (nicIndexValidator == 4 || nicIndexValidator == 2))
                            {
                                errorProvider1.SetError(nicTextBoxX, "Duplicate 'NIC'");
                                retVal = false;
                                changeTabCaptionColor(2, true);
                            }
                            else
                            {
                                errorProvider1.SetError(nicTextBoxX, string.Empty);
                                changeTabCaptionColor(2, false);
                            }
                        }
                        else
                        {
                            errorProvider1.SetError(nicTextBoxX, "Invalied 'NIC'");
                            retVal = false;
                            changeTabCaptionColor(2, true);
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(nicTextBoxX, string.Empty);
                        changeTabCaptionColor(2, false);
                    }
                }

                return(retVal);
            }
            catch (Exception ex)
            {
                MessageView.ExceptionError(ex);
                return(false);
            }
        }
コード例 #29
0
        private void RefreshForm()
        {
            try
            {
                // recidence
                using (Asapuwa asapuwa = new Asapuwa(true))
                {
                    asapuwa.BindToCombo(templaResidenceCombo);
                    asapuwa.BindToCombo(asapuHistrAsapu);
                }
                templaResidenceCombo.SelectedIndex = -1;
                asapuHistrAsapu.SelectedIndex      = -1;

                // robing
                using (Asapuwa asapuwa = new Asapuwa(true))
                {
                    asapuwa.BindToComboHeldUpasampada(templaRobingTookCombo);
                }
                templaRobingTookCombo.SelectedIndex = -1;


                // upasampanna
                using (Asapuwa asapuwa = new Asapuwa(true))
                {
                    asapuwa.BindToComboHeldUpasampada(upasampannaPlaceComboBoxEx);
                }
                upasampannaPlaceComboBoxEx.SelectedIndex = -1;

                // Upadya thero
                using (BikkuInfo bInfo = new BikkuInfo(true))
                {
                    bInfo.BindToComboUpadyaThero(nameofUpadyaComboBoxEx);
                }
                nameofUpadyaComboBoxEx.SelectedIndex = -1;

                // Tutor thero
                using (BikkuInfo bInfo = new BikkuInfo(true))
                {
                    bInfo.BindToComboUpadyaThero(nameOfRobingTutorCombo);
                }
                nameOfRobingTutorCombo.SelectedIndex = -1;


                // viharadhipathi thero
                using (BikkuInfo bInfo = new BikkuInfo(true))
                {
                    bInfo.BindToComboUpadyaThero(nameOfViharadhipathiCombo);
                }
                nameOfViharadhipathiCombo.SelectedIndex = -1;

                // District thero
                using (District dis = new District(true))
                {
                    dis.BindToCombo(districtcomboBox);
                }
                districtcomboBox.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                MessageView.ShowErrorMsg(ex.Message, this.Location);
            }
        }