Exemplo n.º 1
0
        public void deleteRecord()
        {
            try
            {
                if (dataGridView1.SelectedRows.Count > 0)
                {
                    int id = Convert.ToInt32(dataGridView1.SelectedCells[0].Value.ToString());
                    EntTransaction objent = new EntTransaction();
                    objent.TransactionId = id;
                    BLTransation objbl = new BLTransation();
                    int result = objbl.delertRecord(objent);
                    if (result > 0)
                    {
                        MessageBox.Show("Record deleted Successfully..");
                        bindGrid();
                    }
                    else
                    {

                    }
                }
                else
                {
                    MessageBox.Show("please select record first");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Exemplo n.º 2
0
        public int deleteRecord(EntTransaction objent)
        {
            string ConnectionString = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
            SqlConnection con = new SqlConnection(ConnectionString);
            con.Open();
            SqlCommand cmd = new SqlCommand("Usp_DeleteTransaction", con);
            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                cmd.Parameters.AddWithValue("@TransactionId", objent.TransactionId);
                int result = cmd.ExecuteNonQuery();
                return result;
                con.Close();
            }

            catch (Exception ex)
            {
                throw ex;
              // MessageBox.Show(ex.Message.ToString());
            }

            finally
            {
                cmd.Dispose();
                con.Close();
                con.Dispose();
            }
        }
Exemplo n.º 3
0
 public string AddPayment(EntTransaction objentcustomerDetails)
 {
     try
     {
     string strMessage = null;
     SqlConnection con = new SqlConnection(ConnectionString);
     con.Open();
     SqlCommand cmd = new SqlCommand("Usp_SavePaymentDetails", con);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@TransactionID", objentcustomerDetails.TransactionId);
     cmd.Parameters.AddWithValue("@GroupID", objentcustomerDetails.GroupId);
     cmd.Parameters.AddWithValue("@BCReceiverID", objentcustomerDetails.BcRecriverMember);
     cmd.Parameters.AddWithValue("@DeuDate", objentcustomerDetails.DueDate);
     cmd.Parameters.AddWithValue("@DebitAmount", objentcustomerDetails.Amount);
     cmd.Parameters.AddWithValue("@CreditAmount", objentcustomerDetails.ActualAmountforBCCustomer);
     strMessage = cmd.ExecuteNonQuery().ToString();
     return strMessage;
     }
     catch (Exception eo)
     {
         throw eo;
     }
 }
Exemplo n.º 4
0
 public DataTable searchData(EntTransaction objentransaction)
 {
     DLTransaction objdltransaction = new DLTransaction();
     DataTable dt = objdltransaction.searchData(objentransaction);
     return dt;
 }
Exemplo n.º 5
0
 public int delertRecord(EntTransaction objent)
 {
     DLTransaction objdl = new DLTransaction();
        int result = objdl.deleteRecord(objent);
        return result;
 }
Exemplo n.º 6
0
        private void getGroupMembers(int groupId)
        {
            SqlConnection con = new SqlConnection(ConnectionString);
            EntTransaction objentcustomerDetails = new EntTransaction();
            using (SqlConnection sqlCon = new SqlConnection(ConnectionString))
            {
                try
                {
                    #region
                    con.Open();
                    SqlCommand cmd = new SqlCommand("Usp_GetGroupMembers", con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@GroupId", groupId);
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataTable dt = new DataTable();
                    da.Fill(dt);
                    try
                    {
                        if (dt.Rows.Count > 0)
                        {
                            foreach (DataRow row in dt.Rows)
                            {
                                getInstallmentId();
                                string Output;
                                objentcustomerDetails.MemberList = row.Field<String>("Name");
                                objentcustomerDetails.CustomerId = row.Field<int>("CustomerId");

                                objentcustomerDetails.InstallmentId = Convert.ToInt32(lblInstallmentID.Text);
                                objentcustomerDetails.Amount = (float)Convert.ToDouble(txtamount.Text);
                                objentcustomerDetails.Month = Convert.ToInt32(txtmonth.Text);
                                objentcustomerDetails.amountofmonth = (float)Convert.ToDouble(txtmonthandamount.Text);
                                objentcustomerDetails.GroupName = cbgroupname.Text;
                                objentcustomerDetails.ActualAmountforBCCustomer = (float)Convert.ToDouble(txtactulaAmountforbccustomer.Text);
                                objentcustomerDetails.ActualInstallment = (float)Convert.ToDouble(txtactualInstallment.Text);
                                objentcustomerDetails.GroupId = Convert.ToInt32(cbgroupname.SelectedValue.ToString());
                                objentcustomerDetails.InstallmentStatus = "Pending";
                                objentcustomerDetails.BcDate = DateTime.Now;
                                objentcustomerDetails.BcDate = Convert.ToDateTime(txtbcdate.Text);
                                objentcustomerDetails.TransactionId = Convert.ToInt32(txttransationId.Text);
                                BLInstallment objblcustomerdetails = new BLInstallment();
                                Output = objblcustomerdetails.SaveInstallmentForGroupMembers(objentcustomerDetails);
                                //MessageBox.Show("Installment Saved Successfully For Group Members");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message.ToString());
                    }
                    finally
                    {
                        cmd.Dispose();
                        con.Close();
                        con.Dispose();
                    }
                    #endregion
                }
                catch (Exception eo)
                {
                    MessageBox.Show(eo.Message.ToString());
                }
            }
        }
Exemplo n.º 7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int GroupID = Convert.ToInt32(cbgroupname.SelectedValue.ToString());
            //int TransactionID = Convert.ToInt32(txttransationId.Text);
            //int CustID = Convert.ToInt32(txtbcreceivermember.Text);
            try
            {
                if (lblMsgTransaction.Text != "")
                {
                    if (Validate())
                    {
                        if (btnSave.Text == "Save")
                        {
                            string value = string.Empty;
                            string Output = string.Empty;
                            EntTransaction objentcustomerDetails = new EntTransaction();
                            objentcustomerDetails.TransactionId = Convert.ToInt32(txttransationId.Text);
                            objentcustomerDetails.Amount = (float)Convert.ToDouble(txtamount.Text);
                            objentcustomerDetails.Month = Convert.ToInt32(txtmonth.Text);
                            objentcustomerDetails.Member = Convert.ToInt32(txtmember.Text);
                            objentcustomerDetails.amountofmonth = (float)Convert.ToDouble(txtmonthandamount.Text);
                            objentcustomerDetails.Percentage = (float)Convert.ToDouble(txtpercenter.Text);
                            objentcustomerDetails.RemainingMonths = Convert.ToInt32(txtremainingmonths.Text);
                            objentcustomerDetails.GroupName = cbgroupname.Text;

                            objentcustomerDetails.MemberList = cbmemberlist.Text;
                            objentcustomerDetails.OffcetPrice = (float)Convert.ToDouble(txtoffcetprice.Text);
                            objentcustomerDetails.Loss = (float)Convert.ToDouble(txtloss.Text);
                            objentcustomerDetails.ActualAmountforBCCustomer = (float)Convert.ToDouble(txtactulaAmountforbccustomer.Text);
                            objentcustomerDetails.Installment = Convert.ToInt32(txtinstallment.Text);
                            objentcustomerDetails.Drawa = (float)Convert.ToDouble(txtdrawa.Text);
                            objentcustomerDetails.ActualInstallment = (float)Convert.ToDouble(txtactualInstallment.Text);
                            objentcustomerDetails.BcRecriverMember = txtbcreceivermember.Text.ToString();
                            objentcustomerDetails.BcDate = DateTime.Now;
                            objentcustomerDetails.BcDate = Convert.ToDateTime(txtbcdate.Text);
                            objentcustomerDetails.DueDate = DateTime.Now;
                            objentcustomerDetails.DueDate = Convert.ToDateTime(DueDatePicker.Text);
                            objentcustomerDetails.CustomerId = Convert.ToInt32(cbmemberlist.SelectedValue.ToString());
                            objentcustomerDetails.GroupId = Convert.ToInt32(cbgroupname.SelectedValue.ToString());

                            objentcustomerDetails.Drawa1Name = cmbDrawa1Name.Text;
                            objentcustomerDetails.Drawa2Name = cmbDrawa2Name.Text;
                            objentcustomerDetails.Drawa2Amount = Convert.ToInt32(txtdrawn2amount.Text);
                            objentcustomerDetails.RunnerUpName = cmbRunnerUp.Text;
                            objentcustomerDetails.RunnerUpAmount = Convert.ToInt32(txtrunerupAmount.Text.ToString());
                            BLTransation objblcustomerdetails = new BLTransation();
                            Output = objblcustomerdetails.SaveCustomer(objentcustomerDetails);
                            /*
                             * Add Payment Debit Credit code
                             */
                            //if (Convert.ToInt32(Output) > 0)
                            //{
                            //    tempResult =Convert.ToInt32(Output);
                            //}
                            ////DataSet ds = objblcustomerdetails.getData(GroupID);
                            //int count = ds.Tables[0].Rows.Count;
                            //int cnt = 0;
                            //for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                            //{

                            //}
                            //string Payment = objblcustomerdetails.AddPayment(objentcustomerDetails);
                            if (Output == "1")
                            {
                                MessageBox.Show("This Months Transaction Saved Successfully...");
                                getGroupMembers(Convert.ToInt32(cbgroupname.SelectedValue.ToString()));
                                bindGrid();
                                clearFields();
                                getCustomerId();

                            }
                            else
                            {
                                MessageBox.Show("Sorry..! This Months Transaction Has Been Done already");
                                txtbcdate.Focus();
                                //clearFields();
                            }
                            // clearFields();

                        }
                        else
                        {
                            string value = string.Empty;
                            string Output = string.Empty;
                            EntTransaction objentcustomerDetails = new EntTransaction();
                            objentcustomerDetails.TransactionId = Convert.ToInt32(txttransationId.Text);
                            objentcustomerDetails.Amount = (float)Convert.ToDouble(txtamount.Text);
                            objentcustomerDetails.Month = Convert.ToInt32(txtmonth.Text);
                            objentcustomerDetails.Member = Convert.ToInt32(txtmember.Text);
                            objentcustomerDetails.amountofmonth = (float)Convert.ToDouble(txtmonthandamount.Text);
                            objentcustomerDetails.Percentage = (float)Convert.ToDouble(txtpercenter.Text);
                            objentcustomerDetails.RemainingMonths = Convert.ToInt32(txtremainingmonths.Text);
                            objentcustomerDetails.GroupName = cbgroupname.Text;
                            objentcustomerDetails.MemberList = cbmemberlist.Text;
                            objentcustomerDetails.OffcetPrice = (float)Convert.ToDouble(txtoffcetprice.Text);
                            objentcustomerDetails.Loss = (float)Convert.ToDouble(txtloss.Text);
                            objentcustomerDetails.ActualAmountforBCCustomer = (float)Convert.ToDouble(txtactulaAmountforbccustomer.Text);
                            objentcustomerDetails.Installment = Convert.ToInt32(txtinstallment.Text);
                            objentcustomerDetails.Drawa = (float)Convert.ToDouble(txtdrawa.Text);
                            objentcustomerDetails.ActualInstallment = (float)Convert.ToDouble(txtactualInstallment.Text);
                            objentcustomerDetails.BcRecriverMember = txtbcreceivermember.Text.ToString();
                            objentcustomerDetails.BcDate = Convert.ToDateTime(txtbcdate.Text);
                            objentcustomerDetails.DueDate = Convert.ToDateTime(DueDatePicker.Text);
                            objentcustomerDetails.GroupId = Convert.ToInt32(cbgroupname.SelectedValue.ToString());
                            objentcustomerDetails.CustomerId = Convert.ToInt32(cbmemberlist.SelectedValue.ToString());
                            objentcustomerDetails.Drawa1Name = cmbDrawa1Name.Text.ToString();
                            objentcustomerDetails.Drawa2Name = cmbDrawa2Name.Text.ToString();
                            objentcustomerDetails.Drawa2Amount = Convert.ToInt32(txtdrawn2amount.Text);
                            objentcustomerDetails.RunnerUpName = cmbRunnerUp.Text.ToString();
                            objentcustomerDetails.RunnerUpAmount = Convert.ToInt32(txtrunerupAmount.Text.ToString());
                            BLTransation objblcustomerdetails = new BLTransation();

                            Output = objblcustomerdetails.SaveCustomer(objentcustomerDetails);
                            if (Output == "1")
                            {
                                MessageBox.Show("Transactions updated Successfully...");
                            }
                            else
                            {
                                MessageBox.Show("Transactions not updated");
                            }

                            clearFields();

                            bindGrid();
                            txtbcreceivermember.Text = "";
                            btnSave.Text = "Save";
                            getCustomerId();
                            //  getCustomerId();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Please Select Group First");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Exemplo n.º 8
0
 private void searchData()
 {
     EntTransaction objentransaction = new EntTransaction();
     objentransaction.FromDate = Convert.ToDateTime(txtfromDate.Text.ToString());
     objentransaction.ToDate = Convert.ToDateTime(txtToDate.Text.ToString());
     BLTransation objbltransation = new BLTransation();
     DataTable dt = objbltransation.searchData(objentransaction);
     // SqlDataAdapter da = new SqlDataAdapter();
     // da.Fill(dt);
     if (dt.Rows.Count > 0)
     {
         dataGridView1.DataSource = dt;
         dataGridView1.Refresh();
         dataGridView1.Show();
     }
     else
     {
         MessageBox.Show("Record does not found..");
         dataGridView1.DataSource = null;
         dataGridView1.Refresh();
         dataGridView1.Show();
     }
 }
Exemplo n.º 9
0
        public DataTable searchData(EntTransaction objentransaction)
        {
            using (SqlConnection sqlCon = new SqlConnection(ConnectionString))
            try

            {
                #region

                SqlCommand cmd = new SqlCommand("Usp_SearchDatabydate", sqlCon);
                cmd.Parameters.AddWithValue("@FromDate", objentransaction.FromDate);
                cmd.Parameters.AddWithValue("@ToDate", objentransaction.ToDate);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter da = new SqlDataAdapter(cmd);

                DataTable dt = new DataTable();
                da.Fill(dt);
                return dt;
                #endregion

            }
            catch(Exception ex)
            {
                throw ex;
              // MessageBox.Show(ex.Message.ToString());
            }
             finally
                {
                }
        }