private void btnSubmit_Click(object sender, EventArgs e)
 {
     int tId = 0;
     int.TryParse(txtId.Text, out tId);
     double amt = 0;
     amt = Convert.ToDouble(txtTotalCost.Text);
     var tokenDAO = new TokenDao();
     if (tId == 0)
     {
         sdailyNumber = tokenDAO.getHighestDailyNumber(serviceId) + 1;
         dailyNumber = tokenDAO.getMaxDailyNumber(DateTime.Now) + 1;
     }
     var tokenObj = new Token
     {
         Id = tId,
         ServiceId = serviceId,
         Quantity = 1,
         TotalCost = amt,
         ServicePerformDate = Convert.ToDateTime(dtpPerformDate.Value),
         Status = 1,
         ServiceDailyNumber = sdailyNumber,
         DailyNumber = dailyNumber,
         CreatedOn = DateTime.Now,
         CreatedBy = App.LoggedInEmployee.Id
     };
     tokenDAO.SaveToken(tokenObj);
     ShowHundials();
 }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (cmbServiceID.Text != null && fldName.Text != "" && dtValue.Text != null)
            {
                int ServiceID = (cmbServiceID.SelectedItem as Service).Id;
                String fldNameValue = fldName.Text;
                String dtval = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(dtValue.Text));
                var tokenDao = new TokenDao();
                dgvServiceReport.AutoGenerateColumns = false;
                var data = tokenDao.GetServiceReport(ServiceID, fldNameValue, dtval);

                //var totals = new Token();
                //totals.DevoteeName = "Totals";
                //totals.SoldQuantity = data.Sum(x => x.SoldQuantity);
                //totals.TotalCost = data.Sum(x => x.TotalCost);
                //data.Add(totals);
                dgvServiceReport.DataSource = data;
            }
            else
            {
                if (cmbServiceID.Text != null)
                {
                    MessageBox.Show("Select Service");
                }
                else if (fldName.Text != null)
                {
                    MessageBox.Show("Select CreatedOn / ServicePerformDate");
                }
                else if (dtValue.Text != null)
                {
                    MessageBox.Show("Select Date");
                }
            }
        }
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     var devoteeObj = new Devotee
     {
         Id = Convert.ToInt32(txtDevoteeId.Text),
         DevoteeName = txtDevoteeName.Text,
         Prefix = Convert.ToInt32(txtPrefixId.Text),
         Gothram = txtGothram.Text,
         PhoneNumber = txtPhoneNumber.Text,
         EmailId = txtEmail.Text,
         DoorNumber = txtDoorNumber.Text,
         AreaName = txtAreaName.Text,
         City = txtCity.Text,
         MandalName = txtMandalName.Text,
         DistrictName = txtDistrictName.Text,
         StateName = txtStateName.Text,
         OtherDetails = txtOtherDetails.Text
     };
     var devoteeDao = new DevoteesDao();
     int devoteeId = devoteeDao.Update(devoteeObj);
     var tokenDAO = new TokenDao();
     tkn.ServicePerformDate = Convert.ToDateTime(dtpPerformDate.Value);
     tkn.TokenStatus = cmbTokenStatus.Text;
     tokenDAO.UpdateToken(tkn);
 }
 private void BatchDetailsReport_Load(object sender, EventArgs e)
 {
     //List<Token> = new  BatchDao().GetBatchDetails(this.BatchId);
     //dgvBatchDetails
     var tokenObj = new TokenDao();
     dgvBatchDetails.AutoGenerateColumns = false;
     dgvBatchDetails.DataSource = tokenObj.GetSelectedServiceDevotees(StartDailyNumberVal, LastDailyNumberVal, ServiceIDVal);
 }
 private void ServicesPrintForm_Load(object sender, EventArgs e)
 {
     var tokenDao = new TokenDao();
     dgvServiceReport.AutoGenerateColumns = false;
     var data = tokenDao.GetServiceReport(ServiceID, fldNameValue, dtval);
     var totals = new Token();
     totals.DevoteeName = "Totals";
     //totals.SoldQuantity = data.Sum(x => x.SoldQuantity);
     totals.TotalCost = data.Sum(x => x.TotalCost);
     data.Add(totals);
     dgvServiceReport.DataSource = data;
 }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            long startuniid = 0;
            long lastuniid = 0;
            int serviceId = (cmbServiceName.SelectedItem as Service).Id;
            startuniid = new BatchDao().GetLastBatchDailyNumberByService(serviceId);

            int dailyBID = new BatchDao().GetDailyBatchByService(serviceId, cdtval);

            var tokenObj = new TokenDao();
            if (startuniid == 0)
            {
                startuniid = tokenObj.getLeastDailyNumber(serviceId);
                lastuniid = tokenObj.getHighestDailyNumber(serviceId);
            }
            else
            {
                startuniid = startuniid + 1;
                lastuniid = tokenObj.getHighestDailyNumber(serviceId);
            }
            if (startuniid < lastuniid)
            {
                var batchObj = new Batch
                {
                    ServiceId = serviceId,
                    StartDailyNumber = startuniid,
                    LastDailyNumber = lastuniid,
                    CreatedOn = DateTime.Now,
                    DailyBatchId = dailyBID,
                    CreatedBy = App.LoggedInEmployee.Id
                };

                var batchDaoObject = new BatchDao();
                batchDaoObject.SaveBatch(batchObj);
                //batchDaoObject.GetLastBatchByService(serviceId);

                dgvBatchTokens.DataSource = batchDaoObject.GetAllBatches();

                //dgvBatchTokens.DataSource = tokenObj.GetSelectedServiceDevotees(startuniid, lastuniid, serviceId);

                MessageBox.Show("Batch Data Generated Successfully.");
            }
            else
            {
                MessageBox.Show("There is no new data to generate Batch");
            }
        }
Esempio n. 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            var VIPDaoObj = new VIPPrasadamDao();
            var abc = VIPDaoObj.GetDaycount(this.dtpFromDate.Value);
            var dt1 = String.Format("{0:dd-MM-yyyy}", this.dtpFromDate.Value);
            int i = 0;
            String VIPContent = "అతిధి సత్కారం కొరకు " + dt1 + " తేదిన వినియోగించిన సరుకు వివరములు : ";
            while (i < abc.Count)
            {
                var xyz = abc[i] as VIPPrasadam;
                VIPContent = VIPContent + xyz.ServiceName + " " + xyz.Qty;
                i = i + 1;
                if (i < abc.Count)
                {
                    VIPContent = VIPContent + ", ";
                }
            }
            if (abc.Count == 0)
            {
                VIPContent = "";
            }

            DateTime cdatetime = DateTime.Now;
            var cdt = String.Format("{0:dd-MM-yyyy h:mm tt}", cdatetime);
            var DCRGenDT = "Generated on : " + cdt;
            var reportViewer = new ReportViewer();
            reportViewer.HeaderWidthPercent = 100;
            reportViewer.ContentWidthPercent = 100;
            reportViewer.RowsPerPage = 30;

            var duration = dtpToDate.Value - dtpFromDate.Value;

            if (duration.Days > 0)
            {
                reportViewer.HeaderContent = string.Format("<center><h2>Daily Collection Report from {0:dd/MM/yyyy} to {1:dd/MM/yyyy}</h2></center>", this.dtpFromDate.Value, this.dtpToDate.Value);
            }
            else
            {
                reportViewer.HeaderContent = string.Format("<center><h2>Daily Collection Report for the Date of {0:dd/MM/yyyy}</h2></center>", this.dtpFromDate.Value);
            }
            if (VIPContent != "")
            {
                reportViewer.FooterContent = string.Format("<span><br />{0}</span>", VIPContent);
            }

            var tokenDAO = new TokenDao();
            Double CashDt = tokenDAO.GEtTotalCostByTransactionType(dtpFromDate.Value, dtpToDate.Value, "Cash");
            Double CardDt = tokenDAO.GEtTotalCostByTransactionType(dtpFromDate.Value, dtpToDate.Value, "Credit/Debit Card");
            Double DDDt = tokenDAO.GEtTotalCostByTransactionType(dtpFromDate.Value, dtpToDate.Value, "DD");
            Double ChequeDt = tokenDAO.GEtTotalCostByTransactionType(dtpFromDate.Value, dtpToDate.Value, "Cheque");
            var DCRCashDT = "Amount from Cash Transactions : Rs." + CashDt + "/-";
            var DCRCardDT = "Amount from Card Transactions : Rs." + CardDt + "/-";
            var DCRDDDT = "Amount from DD Transactions : Rs." + DDDt + "/-";
            var DCRChequeDT = "Amount from Cheque Transactions : Rs." + ChequeDt + "/-";

            reportViewer.FooterContent = reportViewer.FooterContent + string.Format("<span><br />{0}</span>", DCRGenDT);

            reportViewer.FooterContent = reportViewer.FooterContent + string.Format("<span><br />{0}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{1}</span>", DCRCashDT, DCRCardDT);
            reportViewer.FooterContent = reportViewer.FooterContent + string.Format("<span><br />{0}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{1}</span>", DCRDDDT, DCRChequeDT);

            reportViewer.GenerateFromGridView(this.dgvReport, false);
            reportViewer.Show(this);
        }
Esempio n. 8
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     var tokens = new TokenDao().ProcessTokens(_selectedTokens.ToList(), _selectedDevotees.ToList());
     PrintTokens(tokens);
 }
 private void ShowHundials()
 {
     var serviceDaoObj = new ServiceDao();
     serviceId = serviceDaoObj.GetHundials();
     var tokenDaoObj = new TokenDao();
     dgvHundial.AutoGenerateColumns = false;
     dgvHundial.DataSource = tokenDaoObj.GetHundialsDetails();
 }
Esempio n. 10
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            int devoteeRows = Convert.ToInt32(cmbQty.Text);
            //MessageBox.Show(devoteeRows.ToString());
            if (sType == 2 || sType == 11 || sType == 15)
            {
                //get Devotees and store. Store Single Token.
                var savedTokens = new List<Token>();
                long tokenId = 0;
                //get Devotees and store. Store Multiple Tokens and print MUltiple Tokens.
                int serviceId = 0;
                if (sId == 0)
                {
                    serviceId = sId;
                }
                var tokenDAO = new TokenDao();
                int devoteeId = 0;
                int prefixID = 1;
                String devoteeName = "";
                String devoteeGothram = "";
                String devoteeAdditionalNames = "";
                String devoteeAdditionalGothrams = "";

                if (cmbTransactionType.Text != "Cash" && txtTransactionID.Text == "")
                {
                    MessageBox.Show("Please enter Transaction ID of your Transaction");
                    goto Exitlabel;
                }
                for (int i = 0; i < 1; i++)
                {
                    if (i == 0)
                    {
                        prefixID = Convert.ToInt32(dgvDevotees.Rows[i].Cells[1].Value.ToString());
                        devoteeId = Convert.ToInt32(dgvDevotees.Rows[i].Cells[0].Value.ToString());
                        devoteeName = dgvDevotees.Rows[i].Cells[2].Value.ToString();
                        devoteeGothram = dgvDevotees.Rows[i].Cells[3].Value.ToString();
                    }
                    else
                    {
                        devoteeAdditionalNames = devoteeAdditionalNames + "," + dgvDevotees.Rows[i].Cells[2].Value.ToString();
                        devoteeAdditionalGothrams = devoteeAdditionalGothrams + "," + dgvDevotees.Rows[i].Cells[3].Value.ToString();
                    }
                }

                if (devoteeId == 0)
                {
                    var devoteeObj = new Devotee
                    {
                        DevoteeName = devoteeName,
                        Prefix = prefixID,
                        Gothram = devoteeGothram,
                        DoorNumber = txtDoorNumber.Text,
                        AreaName = txtAreaName.Text,
                        City = txtCity.Text,
                        MandalName = txtMandalName.Text,
                        DistrictName = txtDistrictName.Text,
                        StateName = txtStateName.Text,
                        PhoneNumber = txtPhoneNumber.Text,
                        AdditionalNames = devoteeAdditionalNames,
                        AdditionalGothrams = devoteeAdditionalGothrams,
                        OtherDetails = txtOtherDetails.Text
                    };
                    var devoteeDao = new DevoteesDao();
                    devoteeId = devoteeDao.Save(devoteeObj);
                    // MessageBox.Show(devoteeId.ToString());
                }

                long sdailyNumber = tokenDAO.getHighestDailyNumber(sId) + 1;
                long dailyNumber = tokenDAO.getMaxDailyNumber(DateTime.Now) + 1;

                var tokenObj = new Token
                {
                    ServiceId = sId,
                    DevoteeId = devoteeId,
                    Quantity = Convert.ToInt32(cmbQty.Text),
                    TotalCost = Convert.ToDouble(txtTotalAmount.Text),
                    ServicePerformDate = Convert.ToDateTime(dtpPerformDate.Value),
                    Status = 1,
                    ServiceDailyNumber = sdailyNumber,
                    DailyNumber = dailyNumber,
                    CreatedOn = DateTime.Now,
                    CreatedBy = App.LoggedInEmployee.Id,
                    TransactionType = cmbTransactionType.Text,
                    TransactionID = txtTransactionID.Text,
                    TransactionDate = Convert.ToDateTime(dtpDDChecqueDate.Value)
                };
                tokenId = tokenDAO.SaveToken(tokenObj);
                // MessageBox.Show(tokenId.ToString());

                tokenObj = tokenDAO.getTokenById(tokenId);
                savedTokens.Add(tokenObj);

                if (sType == 2)
                {
                    var sdDao = new StockDetailsDao();
                    int stockVal = Convert.ToInt32(cmbQty.Text);
                    // int CurrStock = sdDao.getStockByServiceId(sId);
                    // stockVal = stockVal - CurrStock;
                    sdDao.UpdateStockDetail(stockVal, sId);
                }

                PrintTokens(savedTokens);
                Exitlabel:
                {
                }
            }
            else if (sType == 9)
            {
                //get Devotees and store. Store Single Token.
                var savedTokens = new List<Token>();
                long tokenId = 0;
                //get Devotees and store. Store Multiple Tokens and print MUltiple Tokens.
                int serviceId = 0;
                if (sId == 0)
                {
                    serviceId = sId;
                }
                /*
                if (cmbTimeId.Text == "" || cmbTimeId.Text == null)
                {
                    MessageBox.Show("Free Annadanam Timings completed for Today. Sorry for the Inconvenience.");
                    goto Exitlabel;
                }
                if (cmbTransactionType.Text != "Cash" && txtTransactionID.Text == "")
                {
                    MessageBox.Show("Please enter Transaction ID of your Transaction");
                    goto Exitlabel;
                }
                int timeIdValue = (cmbTimeId.SelectedItem as Timing).Id;
                */
                int timeIdValue = 1;
                //int TimeValId = 0;
                //String TimeValName = "";
                int TimeValCount = 0;
                //int dgvTimingsRows = App.DayMaxSlots;
                //for (int i = 0; i < dgvTimingsRows; i++)
                {
                    int i = timeIdValue - 1;

                    String i2Val;
                    if (dgvTimings.Rows[i].Cells[2].Value.ToString() != null)
                    {
                        i2Val = Convert.ToString(dgvTimings.Rows[i].Cells[2].Value.ToString());
                    }
                    else
                    {
                        i2Val = "0";
                    }

                    TimeValCount = Convert.ToInt32(i2Val);
                    /*
                    if ((Convert.ToInt32(cmbQty.Text) + TimeValCount) > App.SlotMaxVal)
                    {
                        MessageBox.Show("Slot is not Available for the specified Quantity. Please select another Slot.");
                        goto Exitlabel;
                    }
                    */
                }

                var tokenDAO = new TokenDao();
                int devoteeId = 0;
                int prefixID = 1;
                String devoteeName = "";
                String devoteeGothram = "";
                String devoteeAdditionalNames = "";
                String devoteeAdditionalGothrams = "";
                for (int i = 0; i < devoteeRows; i++)
                {
                    if (i == 0)
                    {
                        prefixID = Convert.ToInt32(dgvDevotees.Rows[i].Cells[1].Value.ToString());
                        devoteeId = Convert.ToInt32(dgvDevotees.Rows[i].Cells[0].Value.ToString());
                        devoteeName = Convert.ToString(dgvDevotees.Rows[i].Cells[2].Value.ToString());
                        devoteeGothram = Convert.ToString(dgvDevotees.Rows[i].Cells[3].Value.ToString());
                    }
                    else
                    {
                        devoteeAdditionalNames = Convert.ToString(devoteeAdditionalNames) + "," + Convert.ToString(dgvDevotees.Rows[i].Cells[2].Value.ToString());
                        devoteeAdditionalGothrams = Convert.ToString(devoteeAdditionalGothrams) + "," + Convert.ToString(dgvDevotees.Rows[i].Cells[3].Value.ToString());
                    }
                }

                if (prefixID <= 0)
                {
                    MessageBox.Show("Please Select Prefix", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (devoteeName == "")
                {
                    MessageBox.Show("Please Enter Devotee Name", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (devoteeId == 0)
                    {
                        var devoteeObj = new Devotee
                        {
                            DevoteeName = devoteeName,
                            Prefix = prefixID,
                            Gothram = devoteeGothram,
                            DoorNumber = txtDoorNumber.Text,
                            AreaName = txtAreaName.Text,
                            City = txtCity.Text,
                            MandalName = txtMandalName.Text,
                            DistrictName = txtDistrictName.Text,
                            StateName = txtStateName.Text,
                            PhoneNumber = txtPhoneNumber.Text,
                            AdditionalNames = devoteeAdditionalNames,
                            AdditionalGothrams = devoteeAdditionalGothrams,
                            OtherDetails = txtOtherDetails.Text
                        };
                        var devoteeDao = new DevoteesDao();
                        devoteeId = devoteeDao.Save(devoteeObj);
                        // MessageBox.Show(devoteeId.ToString());
                    }

                    long sdailyNumber = tokenDAO.getHighestDailyNumber(sId) + 1;
                    long dailyNumber = tokenDAO.getMaxDailyNumber(DateTime.Now) + 1;

                    var tokenObj = new Token
                    {
                        ServiceId = sId,
                        DevoteeId = devoteeId,
                        Quantity = Convert.ToInt32(cmbQty.Text),
                        TotalCost = 0,
                        ServicePerformDate = Convert.ToDateTime(dtpPerformDate.Value),
                        Status = 1,
                        ServiceDailyNumber = sdailyNumber,
                        DailyNumber = dailyNumber,
                        CreatedOn = DateTime.Now,
                        CreatedBy = App.LoggedInEmployee.Id,
                        TimeId = timeIdValue,
                        TransactionType = cmbTransactionType.Text
                    };
                    tokenId = tokenDAO.SaveToken(tokenObj);
                    // MessageBox.Show(tokenId.ToString());

                    tokenObj = tokenDAO.getTokenById(tokenId);
                    savedTokens.Add(tokenObj);

                    PrintTokens(savedTokens);
                }
                Exitlabel:
                {
                }
                //get Devotees and store. Store Multiple Tokens and print First Person name only.
            }
            else if (sType == 10)
            {
                //get Devotees and store in Additional Persons and Additional Gothrams. Store Single Token.
                var savedTokens = new List<Token>();
                long tokenId = 0;
                //get Devotees and store. Store Multiple Tokens and print MUltiple Tokens.
                int serviceId = 0;
                if (sId == 0)
                {
                    serviceId = sId;
                }
                var tokenDAO = new TokenDao();
                int devoteeId = 0;
                int prefixID = 1;
                String devoteeName = "";
                String devoteeGothram = "";
                String devoteeAdditionalNames = "";
                String devoteeAdditionalGothrams = "";
                for (int i = 0; i < devoteeRows; i++)
                {
                    if (i == 0)
                    {
                        prefixID = Convert.ToInt32(dgvDevotees.Rows[i].Cells[1].Value.ToString());
                        devoteeId = Convert.ToInt32(dgvDevotees.Rows[i].Cells[0].Value.ToString());
                        devoteeName = dgvDevotees.Rows[i].Cells[2].Value.ToString();
                        devoteeGothram = dgvDevotees.Rows[i].Cells[3].Value.ToString();
                    }
                    else
                    {
                        devoteeAdditionalNames = devoteeAdditionalNames + "," + dgvDevotees.Rows[i].Cells[2].Value.ToString();
                        devoteeAdditionalGothrams = devoteeAdditionalGothrams + "," + dgvDevotees.Rows[i].Cells[3].Value.ToString();
                    }
                }
                if (cmbTransactionType.Text != "Cash" && txtTransactionID.Text == "")
                {
                    MessageBox.Show("Please enter Transaction ID of your Transaction");
                    goto Exitlabel;
                }
                if (prefixID <= 0)
                {
                    MessageBox.Show("Please Select Prefix", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (devoteeName == "")
                {
                    MessageBox.Show("Please Enter Devotee Name", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {

                    if (devoteeId == 0)
                    {
                        var devoteeObj = new Devotee
                        {
                            DevoteeName = devoteeName,
                            Prefix = prefixID,
                            Gothram = devoteeGothram,
                            DoorNumber = txtDoorNumber.Text,
                            AreaName = txtAreaName.Text,
                            City = txtCity.Text,
                            MandalName = txtMandalName.Text,
                            DistrictName = txtDistrictName.Text,
                            StateName = txtStateName.Text,
                            PhoneNumber = txtPhoneNumber.Text,
                            AdditionalNames = devoteeAdditionalNames,
                            AdditionalGothrams = devoteeAdditionalGothrams,
                            OtherDetails = txtOtherDetails.Text
                        };
                        var devoteeDao = new DevoteesDao();
                        devoteeId = devoteeDao.Save(devoteeObj);
                        // MessageBox.Show(devoteeId.ToString());
                    }

                    double scCost = 0;
                    if (sCost == 0)
                    {
                        scCost = Convert.ToDouble(txtTotalAmount.Text);
                    }
                    else
                    {
                        scCost = sCost;
                    }

                    long sdailyNumber = tokenDAO.getHighestDailyNumber(sId) + 1;
                    long dailyNumber = tokenDAO.getMaxDailyNumber(DateTime.Now) + 1;
                    var tokenObj = new Token
                    {
                        ServiceId = sId,
                        DevoteeId = devoteeId,
                        Quantity = Convert.ToInt32(cmbQty.Text),
                        TotalCost = scCost, //Convert.ToDouble(txtTotalAmount.Text) sCost
                        ServicePerformDate = Convert.ToDateTime(dtpPerformDate.Value),
                        Status = 1,
                        ServiceDailyNumber = sdailyNumber,
                        DailyNumber = dailyNumber,
                        CreatedOn = DateTime.Now,
                        CreatedBy = App.LoggedInEmployee.Id,
                        TransactionType = cmbTransactionType.Text
                    };
                    tokenId = tokenDAO.SaveToken(tokenObj);
                    // MessageBox.Show(tokenId.ToString());

                    tokenObj = tokenDAO.getTokenById(tokenId);
                    savedTokens.Add(tokenObj);

                    PrintTokens(savedTokens);
                }
                Exitlabel:
                {
                }
            }
            else if (sType == 1 || sType == 3 || sType == 4 || sType == 5 || sType == 6 || sType == 7 || sType == 8 || sType == 12)
            {
                {
                    var savedTokens = new List<Token>();
                    long tokenId = 0;
                    //get Devotees and store. Store Multiple Tokens and print MUltiple Tokens.
                    int serviceId = 0;
                    if (sId == 0)
                    {
                        serviceId = sId;
                    }
                    var tokenDAO = new TokenDao();
                    int devoteeId = 0;
                    int prefixID = 1;
                    String devoteeName = "";
                    String devoteeGothram = "";
                    if (cmbTransactionType.Text != "Cash" && txtTransactionID.Text == "")
                    {
                        MessageBox.Show("Please enter Transaction ID or DD/Cheque Number of your Transaction");
                        goto Exitlabel;
                    }
                    int dVal = 1;
                    if (sId != 1)
                    {
                        for (int i = 0; i < devoteeRows; i++)
                        {
                            devoteeId = 0;
                            devoteeId = Convert.ToInt32(dgvDevotees.Rows[i].Cells[0].Value.ToString());
                            devoteeName = dgvDevotees.Rows[i].Cells[2].Value.ToString();
                            devoteeGothram = dgvDevotees.Rows[i].Cells[3].Value.ToString();
                            prefixID = Convert.ToInt32(dgvDevotees.Rows[i].Cells[1].Value.ToString());
                            if (prefixID <= 0)
                            {
                                MessageBox.Show("Please Select Prefix", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                dVal = 0;
                                dgvDevotees.Rows[i].Cells[1].Selected = true;
                                break;
                            }
                            else if (devoteeName == "")
                            {
                                MessageBox.Show("Please Enter Devotee Name", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                dVal = 0;
                                dgvDevotees.Rows[i].Cells[2].Selected = true;
                                break;
                            }
                            else if (devoteeGothram == "")
                            {
                                MessageBox.Show("Please Enter Devotee Gothram", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                dVal = 0;
                                dgvDevotees.Rows[i].Cells[3].Selected = true;
                                break;
                            }
                        }
                        if (sType == 4)
                        {

                            if (txtPhoneNumber.Text == "")
                            {
                                MessageBox.Show("Please Enter Phone Number", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                dVal = 0;
                            }
                            else if (txtCity.Text == "")
                            {
                                MessageBox.Show("Please Enter City or Village", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                dVal = 0;
                            }
                        }
                    }
                    else
                    {
                        dVal = 1;
                    }

                    if (dVal == 1)
                    {
                        for (int i = 0; i < devoteeRows; i++)
                        {
                            devoteeId = 0;
                            devoteeId = Convert.ToInt32(dgvDevotees.Rows[i].Cells[0].Value.ToString());
                            devoteeName = dgvDevotees.Rows[i].Cells[2].Value.ToString();
                            devoteeGothram = dgvDevotees.Rows[i].Cells[3].Value.ToString();
                            prefixID = Convert.ToInt32(dgvDevotees.Rows[i].Cells[1].Value.ToString());

                            if (devoteeId == 0)
                            {
                                //prefixID = int.TryParse(dgvDevotees.Rows[i].Cells[1].Value.ToString(), out prefixId);
                                var devoteeObj = new Devotee
                                {
                                    DevoteeName = dgvDevotees.Rows[i].Cells[2].Value.ToString(),
                                    Prefix = prefixID,
                                    Gothram = dgvDevotees.Rows[i].Cells[3].Value.ToString(),
                                    DoorNumber = txtDoorNumber.Text,
                                    AreaName = txtAreaName.Text,
                                    City = txtCity.Text,
                                    MandalName = txtMandalName.Text,
                                    DistrictName = txtDistrictName.Text,
                                    StateName = txtStateName.Text,
                                    PhoneNumber = txtPhoneNumber.Text,
                                    OtherDetails = txtOtherDetails.Text
                                };
                                var devoteeDao = new DevoteesDao();
                                devoteeId = devoteeDao.Save(devoteeObj);
                                // MessageBox.Show(devoteeId.ToString());
                            }

                            double scCost = 0;
                            if (sCost == 0)
                            {
                                scCost = Convert.ToDouble(txtTotalAmount.Text);
                            }
                            else
                            {
                                scCost = sCost;
                            }

                            long sdailyNumber = tokenDAO.getHighestDailyNumber(sId) + 1;
                            long dailyNumber = tokenDAO.getMaxDailyNumber(DateTime.Now) + 1;
                            var tokenObj = new Token
                            {
                                ServiceId = sId,
                                DevoteeId = devoteeId,
                                Quantity = 1,
                                TotalCost = scCost, //Convert.ToDouble(txtTotalAmount.Text) sCost
                                ServicePerformDate = Convert.ToDateTime(dtpPerformDate.Value),
                                Status = 1,
                                ServiceDailyNumber = sdailyNumber,
                                DailyNumber = dailyNumber,
                                CreatedOn = DateTime.Now,
                                CreatedBy = App.LoggedInEmployee.Id,
                                TransactionType = cmbTransactionType.Text
                            };
                            tokenId = tokenDAO.SaveToken(tokenObj);
                            // MessageBox.Show(tokenId.ToString());

                            tokenObj = tokenDAO.getTokenById(tokenId);
                            savedTokens.Add(tokenObj);

                        }
                        PrintTokens(savedTokens);
                    }
                    else
                    {
                        MessageBox.Show("Please Enter Devotee Details", "Error Occured !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                Exitlabel:
                {
                }
            }
            //(btnPooja + sId).Focus();
            FocusOnBtn(clickedButtonName, 1);
        }
 private void ShowMiscIncomes()
 {
     var serviceDaoObj = new ServiceDao();
     serviceId = serviceDaoObj.GetMiscIncomes();
     var tokenDaoObj = new TokenDao();
     dgvMiscIncomes.AutoGenerateColumns = false;
     dgvMiscIncomes.DataSource = tokenDaoObj.GetMiscIncomeDetails();
 }