Need to have the server make a POST to an API, how do I add POST values to a WebRequest object and how do I send it and get the response (it will be a string) out?
I am new to .Net and I am working on one task. Below is my scenario.
I have 2 tables:
Table 1: Students
StudentID StudentDetail
1 StudentName
2 StudentGrade
Table 2: Student_data
StudentDetail StudentRecords
StudentName John (Default)
StudentName Jacob
StudentName Smith
StudentGrade A (default)
StudentGrade B
StudentGrade C
Question: When window form loads (run time) I need to display StudentRecords in combo box with StudentName = "John" and StudentGrade = "A" as default followed by other values.
StudentName and StudentRecords are in Labels and values are in a ComboBox.
I am using VB.Net and VS 2010 with SQL 2008r2.
I would appreciate any step by step help. Apologies If my request is simple.
Hi,
I am working on a project which needs to extract text form a predefined div tag.
My requirement is to send the content in the target div in a email body. I have to use javascript or php for this task.
The Process :
When a given link will be clicked; a javascript function will trigger and read that target div. The content of the div will be then submitted to server in dynamic form.
What options I have to get this task done?
Thanks.
I have a data processing system that generates very large reports on the data it processes. By "large" I mean that a "small" execution of this system produces about 30 MB of reporting data when dumped into a CSV file and a large dataset is about 130-150 MB (I'm sure someone out there has a bigger idea of "large" but that's not the point... ;)
Excel has the ideal interface for the report consumers in the form of its Data Lists: users can filter and segment the data on-the-fly to see the specific details that they are interested in - they can also add notes and markup to the reports, create charts, graphs, etc... They know how to do all this and it's much easier to let them do it if we just give them the data.
Excel was great for the small test datasets, but it cannot handle these large ones. Does anyone know of a tool that can provide a similar interface as Excel data lists, but that can handle much larger files?
The next tool I tried was MS Access, and found that the Access file bloats hugely (30 MB input file leads to about 70 MB Access file, and when I open the file, run a report and close it the file's at 120-150 MB!), the import process is slow and very manual (currently, the CSV files are created by the same plsql script that runs the main process so there's next to no intervention on my part). I also tried an Access database with linked tables to the database tables that store the report data and that was many times slower (for some reason, sqlplus could query and generate the report file in a minute or soe while Access would take anywhere from 2-5 minutes for the same data)
(If it helps, the data processing system is written in PL/SQL and runs on Oracle 10g.)
When C# app is ran, it POSTS a request to the PHP server, which wants to return an array. What's an easy way to load this array's contents into C# for using with there.
Hello,
I changed the tree of my JSON-P output, and i cannot access to my object DOM anymore :
Here's my output :
jsonp1271634374310(
{"Inter-Medias":
{"name":"Inter-Medias","idGSP":"14","average":"80","services":"8.86"}
});
And here's my jQuery script :
success: function(data, textStatus, XMLHttpRequest){
widget = data.name;
widget += data.average ;
....
I know one level is missing, but if I try to do : data.Inter-Medias.name or data.name.name
it's still not working.
Any idea please ?
I will have case where i'll have multiple Ojbect, so i want to display all of them, how to do that ?
for (i=0;i < data.length;i++)
Does it look right ?
Bonus question : i understand function(data, textStatus, XMLHttpRequest) that in case of success this function is triggered, the data is what the script recieved from his request, but i have no idea what textStatus or XMLHttpRequest are here too and why ?!
Thank you.
Hello!
I'm having trouble getting my head around sending multiple models to a view in mvc.
My problem is the following.
Using EF4 I have a table with attributes organised by category.
Couldn't post an image :-(
[Have a table called attributes (AttributeTitle, AttributeName, CategoryID) connected to a table called Category (CategoryTitle).]
What I want to do is be able to edit an attribute entity and have a dropdown of categories to choose from.
I tried to make a custom viewmodel
public class AttributeViewModel
{
public AttributeViewModel()
{
}
public Attribute Attribute { get; set; }
public IQueryable<Category> AllCategories { get; set; }
}
But it just ended up being a mess.
<div class="editor-field">
<%: Html.DropDownList("Category", new SelectList((IEnumerable)Model.AllCategories, "CategoryID", "CategoryName")) %>
</div>
I was getting it back to the controller...
[HttpPost]
public ActionResult Edit(int AttributeID, FormCollection formcollection)
{
var _attribute = ProfileDB.GetAttribute(AttributeID);
int _selcategory = Convert.ToInt32(formcollection["Category"]);
_attribute.CategoryID = (int)_selcategory;
try
{
UpdateModel(_attribute); (<---Error here)
ProfileDB.SaveChanges();
return RedirectToAction("Index");
}
catch (Exception e)
{
return View(_attribute);
}
}
I've debugged the code and my _attribute looks correct and _attribute.CategoryID = (int)_selcategory updates the model, but then I get the error.
Somewhere here I thought that there should be a cleaner way to do this, and that if I could only send two models to the view instead of having to make a custom viewmodel.
To sum it up:
I want to edit my attribute and have a dropdown of all of the available categories.
Any help much appreciated!
This one has bugged me for the longest time and a great question to ask the Stackoverflow users I think.
I have a rather large SSIS flow that uses a string variable to store the datetime. I would now like to dynamically read the datetime value from the database, but how would you construct the SSIS to do this?
My first obvious thought would be to simply execute a SQL task to get the datetime and store it in the variable, but got the "differs from the current variable type" error.
Is there a simple way to convert the database datetime into a String variable?
Any help from the community would be appreciated,
This is probably a super simple question, but I'm struggling to come up with the right keywords to find it on Google.
I have a Postgres table that has among its contents a column of type text named content_type. That stores what type of entry is stored in that row.
There are only about 5 different types, and I decided I want to change one of them to display as something else in my application (I had been directly displaying these).
It struck me that it's funny that my view is being dictated by my database model, and I decided I would convert the types being stored in my database as strings into integers, and enumerate the possible types in my application with constants that convert them into their display names. That way, if I ever got the urge to change any category names again, I could just change it with one alteration of a constant. I also have the hunch that storing integers might be somewhat more efficient than storing text in the database.
First, a quick threshold question of, is this a good idea? Any feedback or anything I missed?
Second, and my main question, what's the Postgres command I could enter to make an alteration like this? I'm thinking I could start by renaming the old content_type column to old_content_type and then creating a new integer column content_type. However, what command would look at a row's old_content_type and fill in the new content_type column based off of that?
I have a php/flex value object that I am using to transmit data to/from in my application. Everything works great php-flex, but I am having an issue with flex-php.
In my MergeTemplateService.php service I have the following code. This is the method that flex hits directly:
function updateTemplate($valueObject){
$object = DAOFactory::getMergeTemplateDAO()->update($valueObject);
return $object;
}
I am passing a value object that from flex looks like this:
(com.rottmanj.vo::MergeTemplateVO)#0
communityID = 0
creationDate = (null)
enterpriseID = 0
lastModifyDate = (null)
templateID = 2
templateName = "My New Test Template"
userID = 0
The issue I am having is that my updateTemplate method sees the value object as an array and not an object.
In my amfphp globals.php I have set my voPath as: $voPath = "services/class/dto/";
Any help with this is greatly appreciated
Here are my two value objects:
AS3 VO:
package com.rottmanj.vo
{
[RemoteClass(alias="MergeTemplate")]
public class MergeTemplateVO
{
public var templateID:int;
public var templateName:String;
public var communityID:int;
public var enterpriseID:int;
public var userID:int;
public var creationDate:String;
public var lastModifyDate:String
public function MergeTemplateVO(data:Object = null):void
{
if(data != null)
{
templateID = data.templateID;
templateName = data.templateName;
communityID = data.communityID;
enterpriseID = data.enterpriseID;
userID = data.userID;
creationDate = data.creationDate;
lastModifyDate = data.lastModifyDate;
}
}
}
}
PHPVO:
<?php
class MergeTemplate{
var $templateID;
var $templateName;
var $communityID;
var $enterpriseID;
var $userID;
var $creationDate;
var $lastModifyDate;
var $_explictType = 'MergeTemplate';
}
?>
I would like an xsl that replaces the value attribute of the data elements only if the relevant param names are passed.
Input
<applicationVariables applicationServer="tomcat">
<data name="HOST" value="localhost"/>
<data name="PORT" value="8080"/>
<data name="SIZE" value="1000"/>
</applicationVariables>
So for example if passing in a param HOST1=myHost and PORT=9080 the output should be:
<applicationVariables applicationServer="tomcat">
<data name="HOST" value="myHost"/>
<data name="PORT" value="9080"/>
<data name="SIZE" value="1000"/>
</applicationVariables>
Note that HOST and PORT where replaced but SIZE was not replaced because there was no parameter with name SIZE
Since the list of data elements is long (and may change), i would like a generic way of doing this with xsl
Ihave a gridview item template field namely Status as mentioned above ...
i want when user click on hold button of particular row then the record from the particular row is transfered to another page. ... means.... if i click on the hold button of 1st row of gridview then seats=35 and booking closed =08:00:00 PM willbe trasferred to
Me.Response.Redirect("Select_seats.aspx?s_no=" & label22.Text.ToString & "&" & "journey=" & label6.Text & "&" & "seater=" & label4.Text & "&" & "sleeper=" & label2.Text & "&" & "service=" & lab5.Text.ToString) ..
and if i click on the manage button of same row then the record of that row will be transferred to
Me.Response.Redirect("Select_nfo.aspx?s_no=" & label22.Text.ToString & "&" & "journey=" & label6.Text & "&" & "seater=" & label4.Text & "&" & "sleeper=" & label2.Text & "&" & "service=" & lab5.Text.ToString)
I can not figure out why my code does not filter out lists from a predefined list.
I am trying to remove specific list using the following code.
data = [[1,1,1],[1,1,2],[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]]
data = [x for x in data if x[0] != 1 and x[1] != 1]
print data
My result:
data = [[2, 2, 1], [2, 2, 2]]
Expected result:
data = [[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]]
I need to pull 3 values from a table and assign each one to a variable
each value is based on to columns, a type and an id
$ht_live_query = mysql_query("SELECT htcode FROM coupon WHERE pid='$pid' AND type='L'");
$ht_live_result = mysql_fetch_array($ht_live_query);
$htCODE_Live = $ht_live_result['htcode'];
You can see that I am assigning the desired value to the variable $htL
$ht_General_query = mysql_query("SELECT htcode FROM coupon WHERE pid='$pid' AND type='G'");
$ht_General_result = mysql_fetch_array($ht_General_query);
$htCODE_General = $ht_General_result['htcode'];
$ht_Reward_query = mysql_query("SELECT htcode FROM coupon WHERE pid='$pid' AND type='R'");
$ht_Reward_result = mysql_fetch_array($ht_Reward_query);
$htCODE_Reward = $ht_Reward_result ['htcode'];
I know I am doing this the hard way but can not figure out how to do the foreach or while loop to attain the desired results.
This Question has been asked before:
http://stackoverflow.com/questions/2936626/how-to-share-a-dictionary-between-multiple-processes-in-python-without-locking
However I have several doubts regarding the program given in the answer:
The issue is that the following step isn't atomic
d['blah'] += 1
Even with locking the answer provided in that question would lead to random results.
Since
Process 1 read value of d['blah'] saves it on the stack increments it and again writes it.
In Between a Process 2 can read the d['blah'] as well.
Locking means that while d['blah'] is being written or read no other process can access it.
Can someone clarify my doubts?
I cannot get jquery's ajaxSend (http://api.jquery.com/ajaxSend/) to properly modify the parameters. I have:
$(document).ajaxSend(function(event, request, settings) {
settings.data = $.deparam(settings.data);
settings.data['random'] = new Date().getTime();
settings.data['_method'] = 'get';
settings.data = $.param(settings.data)
$.log(settings);
});
$(document).ready(function() {
//...snip...
$.ajaxSetup({
data : {
remote : 1,
authenticity_token : encodeURIComponent(AUTH_TOKEN)
}
});
});
The idea here is that we always want 4 param sent across: remote and auth_token always get set properly. However, random and _method (both needed for IE issues) do not get set. Logging settings inside ajaxSend shows me that they are set to settings.data:
"remote=1&authenticity_token=6GA9R_snip_253D&random=1270584905846&_method=get"
but when it gets sent across the wire, I only have the following:
authenticity_token 6GA9R_snip_253D
remote 1
Why in the world is this not working?
Hi All,
I have a string say string s ="C:\\Data" , I have an array which contains some strings containg "C:\Data" in the beginning i.e. string[] arr = new {"C:\\Data\abc.xml","C:\\Data\Test\hello.cs"};.
I have to remove the string "C:\Data" from each entry and have to combine it with another string say string fixed = "D:\\Data".
What is the best way to do it, please help as I am a new programmer in C#.
Hi, I am learning cakephp by myself. I tried to create a user controller with a changepassword function. It works, but I am not sure if this is the best way, and I could not googled up useful tutorials on this.
Here is my code:
class UsersController extends AppController {
var $name = 'Users';
function login() {
}
function logout() {
$this->redirect($this->Auth->logout());
}
function changepassword() {
$session=$this->Session->read();
$id=$session['Auth']['User']['id'];
$user=$this->User->find('first',array('conditions' => array('id' => $id)));
$this->set('user',$user);
if (!empty($this->data)) {
if ($this->Auth->password($this->data['User']['password'])==$user['User']['password']) {
if ($this->data['User']['passwordn']==$this->data['User']['password2']) {
// Passwords match, continue processing
$data=$this->data;
$this->data=$user;
$this->data['User']['password']=$this->Auth->password($data['User']['passwordn']);
$this->User->id=$id;
$this->User->save($this->data);
$this->Session->setFlash('Password changed.');
$this->redirect(array('controller'=>'Toners','action' => 'index'));
} else {
$this->Session->setFlash('New passwords differ.');
}
} else {
$this->Session->setFlash('Typed passwords did not match.');
}
}
}
}
password is the old password, passwordn is the new one, password2 is the new one retyped.
Is there any other, more coomon way to do it in cake?
hello,
i need ur help guys..i m making website for 'home docor ideas'..i have a log in form(login-form.php) in which when 'log in' and 'password' is inserted,after verification through login-execute.php, redirected to viewOrder.php where user can view all of the orders ordered by clients.. all is fine up till here.. but what i want is,when user get logged in ,he view only that order which is ordered by him not all customer's orders.. two tables are there in database: members and order_insert.. in 'members' table, login and password is stored and in 'order_insert',orders of customers is stored.. codes of these three pages is as follows..
.........................
login-form.php
.........................
<form id="loginForm" name="loginForm" method="post" action="login-exec.php">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="112"><b>Login</b></td>
<td width="188"><input name="login" type="text" class="textfield" id="login" /></td>
</tr>
<tr>
<td><b>Password</b></td>
<td><input name="password" type="password" class="textfield" id="password" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Login" /></td>
</tr>
</table>
</form>
.........................
login-execute.php
.........................
<?php
//Start session
session_start();
//Include database connection details
require_once('config.php');
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$login = clean($_POST['login']);
$password = clean($_POST['password']);
//Input Validations
if($login == '') {
$errmsg_arr[] = 'Login ID missing';
$errflag = true;
}
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}
//If there are input validations, redirect back to the login form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: login-form.php");
exit();
}
//Create query
$qry="SELECT * FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'";
$result=mysql_query($qry);
//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result) == 1) {
//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = $member['member_id'];
$_SESSION['SESS_FIRST_NAME'] = $member['firstname'];
$_SESSION['SESS_LAST_NAME'] = $member['lastname'];
session_write_close();
header("location: viewOrder.php");
exit();
}else {
//Login failed
header("location: login-failed.php");
exit();
}
}else {
die("Query failed");
}
?>
.............................
viewOrder.php
..............................
<html>
<body bgcolor="#FFFFFF" >
<?
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="mydatabase"; // Database name
$tbl_name="order_insert"; // Table name
$tbl_name2="members";
// connect to server and databases
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$result = mysql_query("SELECT * FROM $tbl_name ");
print "<center>";
$output .= "<table width=1100 border=1 bordercolor=black>";
$output .= "<tr align=center><td>ID</td><td>First Name</td><td>Last Name</td><td>E Mail</td><td> City </td><td> Country </td><td> Phone</td><td>Decoration Type</td><td>Service Description</td><td>Budget</td><td>Update</td><td>Delete</td></tr>";
$output .= "<th></th><th></th>";
$output .= "</tr>\n\n";
while ($row = mysql_fetch_assoc($result)){
$output .= "<tr>\n";
foreach ($row as $col=>$val){
$output .= " <td>$val</td>\n";
} // end foreach
$keyVal = $row["id"];
$output .= "<td><a href='update.php?ID=$row[orderId]' >Update </a></td>";
$output .= "<td><a href='delete.php?ID=$row[orderId]' >Delete </a></td>";
$output .= "</tr>\n\n";
}// end while
$output .= "</table></center>";
print "$output";
?> <br>
<br>
<center><table > <tr><td>
<form action="home.php"><font color="#FF0000"><input type="submit" name="btn" style="color:#CC0000" value="<--Back" ></font></form></td></tr></table></center>
</body>
</html>
.....
your help and suggestions will be appreciated
Hello here I have a big problem that I hope to find help
here I have two entities
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="Role", discriminatorType=DiscriminatorType.STRING)
public class Utilisateur implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
private Long id;
@Column(name="nom",nullable=false)
private String nom;
@Column(name="Role",nullable=false, insertable=false)
private String Role ;
//...
}
@Entity
@Table(name="ResCom")
@DiscriminatorValue("ResCom")
public class ResCom extends Utilisateur {
/...
}
the first thing I do
ResCom rsCom= new ResCom(nom,prenom, email,civilite,
SysQl.crypePasse(pass));
gr.create(rsCom);
I check my database I see that property is ResCom insert
but when I check the value of role I get null
Utilisateur tets= gr.findByEmail(email);
message=tets.getEmail()+" and Role :"+tets.getRole()+"";
but in my bass it ResCom !!!!!
the problem disappears when I deploy the project again
I hope you have a solution
And thank you in advance
sorry for my English
I have 2 features that use a common 'When' step but have different 'Then' steps in different classes.
How do I access, for example, the ActionResult from my MVC controller call in the When step in my two Then steps?
I can do this:
SELECT t2.value + sum(t3.value)
FROM tableA t2, tableB t3
WHERE t2.somekey = t3.somekey
GROUP BY t3.somekey
But how to do this?
UPDATE tableA t1
SET speed = (
SELECT t2.value + sum(t3.value)
FROM tableA t2, tableB t3
WHERE t2.somekey = t3.somekey
AND t1.somekey = t3.somekey
GROUP BY t3.somekey
)
;
MySQL says it's illegal since you can't specify target table t1 for update in FROM clause.
as topic, I just want create new Entity(table) in sqlite ,
my code as follows:
+(BOOL)CreateDataSet:(NSManagedObjectModel *) model
attributes:(NSDictionary*)attributes
entityName:(NSString*) entityName
{
NSEntityDescription *entityDef = [[NSEntityDescription alloc] init];
[entityDef setName:entityName];
[entityDef setManagedObjectClassName:entityName];
[model setEntities:[NSArray arrayWithObject:entityDef]];
//@step
NSArray *properties = [CoreDataHelper CreateAttributes:attributes];
[entityDef setProperties:properties];
[entityDef release];
return TRUE;
}
but it throw errors:
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Can't modify an immutable model.'
* Call stack at first throw:
(
0 CoreFoundation 0x01c5abe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01daf5c2 objc_exception_throw + 47
2 CoreData 0x0152634a -[NSManagedObjectModel(_NSInternalMethods) _throwIfNotEditable] + 106
3 CoreData 0x01526904 -[NSManagedObjectModel setEntities:] + 36
....
that seem show the model is read only.....
anyone can help on this problem? thanks
I'm using codeigniter as i mentioned
this is a part of my view code
foreach($projects_query as $row)// $row indicates the projects
{ ?>
<tr><td><h3><button type="submit" class="button red-gradient glossy" name = "project_click" >
<?php echo $row->txtTaskName; ?></button></h3></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<?php
foreach($tasks_query as $row2)
{
// if( $row->txtTaskName == "TestProject")
if($row->intTaskID == $row2->intInside)// intInside indicades that the current task($row2) is the subset of which task (system , subsystem or project)
{
if($row2->intSummary == 0)//if the task(the system) is an executable task & doesn't have any subtask:
{
$query_team_user_id = $this->admin_in_out_model->get_user_team_task_query($row2->intTaskID);//runs the function and generates a query from tbl_userteamtask where intTaskID equals to the selected row's intTaskID
foreach($query_team_user_id as $row_teamid)
{
$query_teamname = $this->admin_in_out_model->get_team_name($row_teamid->intTeamID);
$query_fn_ln = $this->admin_in_out_model->get_fn_ln_from_userid($row_teamid->intUserID);
foreach($query_teamname as $row_teamname)
{?>
<tr><td></td><td></td><td><h4> <?php echo $row2->txtTaskName;?></h4></td>
<td><b><font color='#F33558'><?php echo $row_teamname->txtTeamName;?></font></b></td>
<?php }
foreach($query_fn_ln as $row_f_l_name)
{?>
<td> <?php echo $row_f_l_name->txtFirstname." ".$row_f_l_name->txtLastname;?></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<?php }?>
</tr>
<?php }
}
else{ ?> <tr><td></td><td></td><td><h4> <?php echo $row2->txtTaskName;?></h4></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><?php }
foreach($tasks_query as $row_subsystems)
{
if($row_subsystems->intInside == $row2->intTaskID )//if the task is the subtask of a system(it means the task is a subsystem)
{
if($row_subsystems->intSummary == 0)//if the task is an executable task & doesn't have any subtask:
{
$query_team_user_id = $this->admin_in_out_model->get_user_team_task_query($row_subsystems->intTaskID);
foreach($query_team_user_id as $row_teamid)
{?>
<tr><?php
$query_teamname = $this->admin_in_out_model->get_team_name($row_teamid->intTeamID);
$query_fn_ln = $this->admin_in_out_model->get_fn_ln_from_userid($row_teamid->intUserID);
foreach($query_teamname as $row_teamname)
{?>
<td></td><td></td><td><h5><?php echo $row_subsystems->txtTaskName?></h5><br/></td>
<td><b><font color='#F33558'><?php echo $row_teamname->txtTeamName;?></font></b></td><?php
}
foreach($query_fn_ln as $row_f_l_name)
{?>
<td><?php echo $row_f_l_name->txtFirstname." ".$row_f_l_name->txtLastname;?></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><?php
}?>
</tr><?php
}
}
else{ ?><tr><td></td><td></td><td><h5><?php echo $row_subsystems->txtTaskName?></h5></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><?php }
foreach($tasks_query as $row_tasks)
{
if($row_tasks->intInside == $row_subsystems->intTaskID )//if the task is the subtask of a subsystem
{
if($row_tasks->intSummary == 0)//if the task is an executable task & doesn't have any subtask:
{
$query_team_user_id = $this->admin_in_out_model->get_user_team_task_query($row_tasks->intTaskID);
foreach($query_team_user_id as $row_teamid)
{?>
<tr><?php
$query_teamname = $this->admin_in_out_model->get_team_name($row_teamid->intTeamID);
$query_fn_ln = $this->admin_in_out_model->get_fn_ln_from_userid($row_teamid->intUserID);
foreach($query_teamname as $row_teamname)
{?>
<td></td><td></td><td><b><?php echo $row_tasks->txtTaskName;?></b></td>
<td><b><font color='#F33558'><?php echo $row_teamname->txtTeamName;?></font></b></td><?php
}
foreach($query_fn_ln as $row_f_l_name)
{?>
<td><?php echo $row_f_l_name->txtFirstname." ".$row_f_l_name->txtLastname;?></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><?php
}?>
</tr><?php
}
}
}
}
}
}
}
}
}?>
and in controller i have
$projects_query = $this->admin_in_out_model->get_projects();
$tasks_query = $this->admin_in_out_model->get_systems();
$userteamtask = $this->admin_in_out_model->get_user_team_task();
$data['tasks_query'] = $tasks_query;
$data['projects_query'] = $projects_query;
$this->load->view('project_view',$data);
but as you see I'm calling my model functions within the view
how can i do something else to do this i mean not calling my model function in my view
I have to add that, my model function have parameters
these are the model functions:
function get_projects()
{
$this -> db -> select('*');
$this -> db -> from('tbl_task');
$this -> db -> where('intInside','0');
$query = $this->db->get();
return $query->result();
}
function get_systems()
{
$this -> db -> select('*');
$this -> db -> from('tbl_task ');
$this -> db -> where('intInside <> ','0');
$query = $this->db->get();
return $query->result();
}
function get_user_team_task_query($task_id)//gets information from tbl_userteamtask where the field intTaskID is equal to $task_id
{
$this -> db -> select('*');
$this -> db -> from('tbl_userteamtask');
$this -> db -> where('intTaskID',$task_id);
$query_teamid = $this->db->get();
return $query_teamid->result();
}
function get_user_team_task()//gets information from tbl_userteamtask where the field intTaskID is equal to $task_id
{
$this -> db -> select('*');
$this -> db -> from('tbl_userteamtask');
// $this -> db -> where('intTaskID',$task_id);
$query_teamid = $this->db->get();
return $query_teamid->result();
}
function get_team_name($query_teamid)
{
$this -> db -> select('*');
$this -> db -> from('tbl_team');
$this -> db -> where('intTeamID',$query_teamid);
$query_teamname = $this->db->get();
return $query_teamname->result();
}
function get_user_name($query_userid)
{
$this -> db -> select('*');
$this -> db -> from('tbl_user');
$this -> db -> where('intUserID',$query_userid);
$query_username = $this->db->get();
return $query_username->result();
}
function get_fn_ln_from_userid($selected_id)
{
$this -> db -> select('tbl_user.intUserID, tbl_user.intPersonID,tbl_person.intPersonID,tbl_person.txtFirstname, tbl_person.txtLastname');
$this -> db -> from('tbl_user , tbl_person');
$where = "tbl_user.intPersonID = tbl_person.intPersonID ";
$this -> db -> where($where);
$this -> db -> where('tbl_user.intUserID', $selected_id);
$query = $this -> db -> get();//makes query from DB
return $query->result();
}
do I have to use subquery ?
is this true? i mean can i do this?
foreach( $data as $key => $each )
{
$data[$key]['team_id'] = $this->get_user_team_task_query( $each['intTaskID'] );
foreach($data[$key]['team_id'] as $key_teamname => $each)
{
$data[$key_teamname]['team_name'] = $this->get_team_name( $each['intTeamID'] );
}
}
the model code:
foreach( $data as $key => $each )
{
$data[$key]['intTaskID'] = $each['intTaskID'];
$data[$key]['team_id'] = $this->get_user_team_task_query( $each['intTaskID'] );
foreach($data[$key]['team_id'] as $key => $each)
{
$data[$key]['team_name'] = $this->get_team_name( $each['intTeamID'] ); #fetching of the teamname and saving in the array
$data[$key]['user_name'] = $this->get_fn_ln_from_userid( $each['intUserID'] );
foreach($data[$key]['user_name'] as $key => $each)
{
$data[$key]['first_name'] = $each['txtFirstname'] ;
$data[$key]['last_name'] = $each['txtLastname'] ;
}
$data[$key]['first_name'] = $data[$key]['first_name'];
$data[$key]['last_name'] = $data[$key]['last_name'];
}
}
The other day I tried out VS2010's SQL compare tools and thought they were awesome.
I am wondering if there is any way to harness these tools in code written in VS 2010.