private void ArrayWalk(string[] data, OutPutProcess process)
 {
     foreach (var value in data)
     {
         process(value);
     }
 }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //int totalcheque = 0;

            cheque.Address1  = cmbBranch.Text;
            cheque.Name1     = txtAccountName1.Text;
            cheque.Name2     = txtAccountName2.Text;
            cheque.AccountNo = txtAccountNumber.Text;
            cheque.Quantity  = int.Parse(txtOrQty.Text);


            if (rdbPersonal.Checked == true || rdbCommercial.Checked == true || rdbChargeSlip.Checked == true)
            {
                if (rdbPersonal.Checked == true)
                {
                    // lblPcsperbook.Text = "50 Pcs. / Bkt";

                    cheque.ChequeType = "A";
                    cheque.PcsPerBook = 50;
                    cheque.ChequeName = rdbPersonal.Text;
                    //totalcheque = cheque.Quantity * 50;
                    // cheque.EndingSerial = (LastNo  + totalcheque).ToString();
                }
                if (rdbCommercial.Checked == true)
                {
                    //lblPcsperbook.Text = "100 Pcs. / Bkt";

                    cheque.ChequeType = "B";
                    cheque.PcsPerBook = 100;
                    cheque.ChequeName = rdbCommercial.Text;
                }
                if (rdbChargeSlip.Checked == true)
                {
                    //  lblPcsperbook.Text = "50 Pcs. / Bkt";
                    OutPutProcess.InputBox("", "Input Serial Number :", ref stringchargeSlipSerial);
                    cheque.ChequeType = "CS";
                    cheque.PcsPerBook = 50;
                    cheque.ChequeName = rdbChargeSlip.Text;
                }


                br.DateUpdated = DateTime.Now;

                for (int i = 0; i < cheque.Quantity; i++)
                {
                    if (cheque.ChequeType == "A")
                    {
                        //LastNoP += 50;

                        cheque.StartingSerial = (LastNoP + 1).ToString();
                        LastNoP            += 50;
                        cheque.EndingSerial = LastNoP.ToString();
                        db.SaveToTempTable(cheque);
                        br.LastNo_P = Int64.Parse(cheque.EndingSerial);
                    }
                    else if (cheque.ChequeType == "B")
                    {
                        cheque.StartingSerial = (LastNoC + 1).ToString();

                        LastNoC            += 100;
                        cheque.EndingSerial = (LastNoC + 100).ToString();
                        db.SaveToTempTable(cheque);
                        br.LastNo_C = Int64.Parse(cheque.EndingSerial);
                    }
                    else if (cheque.ChequeType == "CS")
                    {
                        chargeSlipSerial      = Int64.Parse(stringchargeSlipSerial);
                        cheque.StartingSerial = chargeSlipSerial.ToString();
                        chargeSlipSerial     += 50;
                        cheque.EndingSerial   = (chargeSlipSerial - 1).ToString();

                        db.SaveToTempTable(cheque);
                        //br.LastNo_CS = Int64.Parse(cheque.EndingSerial);
                        stringchargeSlipSerial = chargeSlipSerial.ToString();
                    }
                }



                MessageBox.Show("Data has been saved!");
                ClearForm();
                CheckLoadData();
            }
            else
            {
                MessageBox.Show("Please Choose Cheque Type!!!");
            }
        }