Example #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string vMessage = string.Empty;

                if (txtMemberName.Text.Trim() == string.Empty)
                {
                    vMessage = "Please Select From Account.";
                    Message.ShowMessage(MyMessages.MessageType.MissingInfo, vMessage);
                    txtMemberID.Focus();
                    return;
                }

                if (optCheque.Checked == true && txtCheqNo.Text.Trim() == string.Empty)
                {
                    vMessage = "Please Enter Cheque No.";
                    Message.ShowMessage(MyMessages.MessageType.MissingInfo, vMessage);
                    txtCheqNo.Focus();
                    return;
                }

                int vNoOfShares = 0;
                int.TryParse(txtNoOfShares.Text, out vNoOfShares);

                if (vNoOfShares == 0)
                {
                    vMessage = "Please Enter Number of Shares.";
                    Message.ShowMessage(MyMessages.MessageType.MissingInfo, vMessage);
                    txtNoOfShares.Focus();
                    return;
                }

                decimal vPerShareVal = 0;
                decimal.TryParse(txtSharePrice.Text, out vPerShareVal);

                //Int64 vAmount;
                //Int64.TryParse(txtTotalAmount.Text, out vAmount);

                //if (vAmount == 0)
                //{
                //    vMessage = "Deposited Amount not entered.";
                //    new Speak().SayIt(vMessage);
                //    MessageBox.Show(vMessage, "Information Missing");
                //    txtTotalAmount.Focus();
                //    return;
                //}



                Objects.SharesIssue obj = new Objects.SharesIssue();
                obj.IssueID       = Int64.Parse(txtID.Text);
                obj.IssueDate     = dtIssueDate.Value;
                obj.SchemeID      = int.Parse(cboScheme.SelectedValue.ToString());
                obj.MemberID      = Int64.Parse(txtMemberID.Text);
                obj.NoOfShares    = vNoOfShares;
                obj.PerShareValue = vPerShareVal;
                if (optCash.Checked)
                {
                    obj.ModeofPayment = "Cash";
                    obj.ChequeNo      = "";
                }
                else
                {
                    obj.ModeofPayment = "Cheque";
                    obj.ChequeNo      = txtCheqNo.Text.Trim();
                }


                obj.Remarks = txtRemarks.Text;
                obj.UserID  = vUserID;

                if (!vOpenMode)
                {
                    //Insert
                    objDAL.InsertRecord(obj);
                }
                else
                {
                    objDAL.UpdateRecord(obj);
                }

                Message.ShowMessage(MyMessages.MessageType.SaveRecord);

                if (Message.ConfrmPrintMsg())
                {
                    PrintRecord(obj.IssueID);
                }

                btnClear_Click(sender, e);
            }
            catch (Exception exc)
            {
                Message.ShowMessage(MyMessages.MessageType.Error, exc.Message);
            }
        }