public List <clsInstallmentPlanDetails> GetInstallmentPlanDetailsByPlanCode(string id)
        {
            List <clsInstallmentPlanDetails> lst = new List <clsInstallmentPlanDetails>();

            using (SqlConnection conn = new SqlConnection(strConn))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("TMR_USP_GetInstallmentPlanDetailsByPlanCode"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = conn;
                    cmd.Parameters.AddWithValue("@InstallmentPlanCode", id);

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        var info = new clsInstallmentPlanDetails();
                        info.intId = Convert.ToInt32(reader["id"]);
                        info.strInstallmentPlanCode       = reader["InstallmentPlanCode"].ToString();
                        info.intInstallmentPlanID         = Convert.ToInt32(reader["InstallmentPlanID"]);
                        info.intInstallmentType           = Convert.ToInt32(reader["InstallmentType"]);
                        info.strInstallmentTypeName       = reader["InstallmentTypeName"].ToString();
                        info.intInstallmentDueAfterMonths = Convert.ToInt32(reader["InstallmentDueAfterMonths"]);
                        info.decInstallmentPercentage     = Convert.ToDecimal(reader["InstallmentPercentage"]);
                        info.intInstallmentNumber         = Convert.ToInt32(reader["InstallmentNumber"]);

                        lst.Add(info);
                    }
                    conn.Close();
                }
            }
            return(lst);
        }
        public bool AddInstallmentPlanDetail(clsInstallmentPlanDetails info)
        {
            int st = 0;

            try
            {
                using (SqlConnection conn = new SqlConnection(strConn))
                {
                    conn.Open();

                    {
                        using (SqlCommand cmd = new SqlCommand("TMR_USP_AddInstallmentPlanDetails"))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Connection  = conn;

                            cmd.Parameters.AddWithValue("@IntallmentPlanCode", info.strInstallmentPlanCode);
                            cmd.Parameters.AddWithValue("@IntallmentPlanID", info.intInstallmentPlanID);
                            cmd.Parameters.AddWithValue("@InstallmentType", info.intInstallmentType);
                            cmd.Parameters.AddWithValue("@InstallmentDueAfterMonths", info.intInstallmentDueAfterMonths);
                            cmd.Parameters.AddWithValue("@InstallmentPercentage", info.decInstallmentPercentage);
                            cmd.Parameters.AddWithValue("@InstallmentNumber", info.intInstallmentNumber);
                            st = cmd.ExecuteNonQuery();
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex) { }
            if (st > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }