Пример #1
0
 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);
 }
Пример #2
0
        private void btnAddService_Click(object sender, EventArgs e)
        {
            var selectedService = cmbServices.SelectedItem as Service;
            var token = new Token();
            token.ServiceId = selectedService.Id;
            token.ServiceName = selectedService.Name;
            token.Quantity = Convert.ToInt32(txtQuantity.Text);
            token.TotalCost = token.Quantity * Convert.ToDouble(txtCost.Text);
            token.CreatedBy = App.LoggedInEmployee.Id;
            token.CreatedOn = DateTime.Now;

            _selectedTokens.Add(token);
            mtxtServiceNumber.Clear();
            txtQuantity.Text = "1";
            mtxtServiceNumber.Focus();

            for (int i = 0; i < token.Quantity; i++)
            {
                var newDevotee = new Devotee();
                newDevotee.TokenIndex = _selectedDevotees.Count + 1;
                newDevotee.ServiceName = token.ServiceName;
                newDevotee.Prefix = 1;
                newDevotee.DevoteeName = string.Empty;
                newDevotee.Gothram = string.Empty;

                _selectedDevotees.Add(newDevotee);
            }
        }
Пример #3
0
 public int Update(Devotee devotee)
 {
     using (var db = new eTempleDbDB())
     {
         db.Update(devotee);
         return devotee.Id;
     }
 }
Пример #4
0
 private void devoteeAdd(int cmdqty)
 {
     if (sType != 2 && sType != 11 && sType != 15)
     {
         int i;
         //dgvDevotees.DataSource = null;
         //_selectedDevotees.Clear();
         _copiedDevotees = _selectedDevotees;
         _selectedDevotees.Clear();
         for (i = 0; i < cmdqty; i++)
         {
             /*
             if (_copiedDevotees.Count > 0)
             {
                 _selectedDevotees.Add(_copiedDevotees[i]);
             }
             else
             */
             {
                 var newDevotee = new Devotee();
                 newDevotee.Prefix = 1;
                 newDevotee.Id = 0;
                 newDevotee.DevoteeName = string.Empty;
                 newDevotee.Gothram = string.Empty;
                 _selectedDevotees.Add(newDevotee);
             }
         }
     }
     else
     {
         _copiedDevotees = _selectedDevotees;
         _selectedDevotees.Clear();
         var newDevotee = new Devotee();
         newDevotee.Prefix = 1;
         newDevotee.Id = 0;
         newDevotee.DevoteeName = string.Empty;
         newDevotee.Gothram = string.Empty;
         _selectedDevotees.Add(newDevotee);
     }
 }
Пример #5
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);
        }