namespace SDKTrackit { public partial class Form1 : Form { string connString = ConfigurationManager.ConnectionStrings["load"].ConnectionString.ToString(); private SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["track"].ToString()); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { DatabaseContext.Initialise("NFS_INDUSTRIAL", "EvolutionCommon", "ANGELICA-NB", "TrackitTest", "trackit", "DE07110052", "2328785"); SqlConnection con = new SqlConnection(connString); con.Open(); SqlCommand comm = new SqlCommand("timesheetProc", con); SqlCommand comm1 = new SqlCommand("ECSflag", con); SqlCommand comm2 = new SqlCommand("ECSLinesUpdate", con); SqlDataAdapter adpt = new SqlDataAdapter(comm); DataTable data = new DataTable(); adpt.Fill(data); foreach (DataRow row in data.Rows) { string clientName = row["client_name"].ToString(); string accountCode = row["account_code"].ToString(); string projectCode = row["project_code"].ToString(); int taskID = Convert.ToInt32(row["task_id"]); int flag = Convert.ToInt32(row["flag"]); int projectLink = Convert.ToInt32(row["project_link"]); JobCard jc = new JobCard(); jc.PostingMethod = JobPostingMethod.CompletedContract; jc.Status = Pastel.Evolution.JobCard.JobStatus.Active; jc.Account = new Customer(accountCode); JobDetail jd = new JobDetail(); jd.TransactionCode = new JobTransactionCode(JobDetail.TransactionSource.Inventory, "ST"); jd.Status = Pastel.Evolution.JobCard.JobStatus.Active; jd.InventoryItem = new InventoryItem(taskID); jd.Project = new Project(projectLink); //My error is here;im unable to assign a project to the job card jd.Warehouse = new Warehouse("CPT"); jd.UnitSellingPrice = jd.InventoryItem.SellingPrices[jc.Account.DefaultPriceListID].PriceIncl; jd.Quantity = 2; jc.Detail.Add(jd); jc.Save(); } comm.ExecuteNonQuery(); con.Close(); MessageBox.Show("Job Card Created"); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)