private void cbxProductDesc_SelectedIndexChanged(object sender, EventArgs e) { using (var context = new SPEntities()) { if (cbxProductDesc.SelectedItem != null) { int value = Convert.ToInt32(cbxProductDesc.SelectedValue); var ID = context.Products.Where(z => z.Product_ID == value).First(); txtProdID.Text = ID.Product_ID.ToString(); txtPrice.Text = ID.Sales_Price.ToString(); txtQuantity.Text = ID.Available_Quantity.ToString(); } // var details = context.Products.Where(x => x.Product_ID == ID.Product_ID).Select(x => x.Sales_Price).First(); //var details1 = context.Products.Where(y => y.Product_ID == ID).FirstOrDefault(); //txtProdID.Text = Convert.ToString(value); //txtPrice.Text = details.ToString(); } }
private void frmAddCity_Load(object sender, EventArgs e) { using (SPEntities db = new SPEntities()) { provinceBindingSource.DataSource = db.Provinces.ToList(); } }
private void frmAddClient_Load(object sender, EventArgs e) { toolTip1.SetToolTip(this.txtName, "Enter Client Name "); toolTip1.SetToolTip(this.txtVatRegNum, "Enter 10 digit Vat Registration number"); toolTip1.SetToolTip(this.txtTelephone, "Enter 10 digit telephone number"); toolTip1.SetToolTip(this.txtFaxNumber, "Enter 10 digit fax number number"); toolTip1.SetToolTip(this.txtEmailAdd, "Enter a valid email containing @"); toolTip1.SetToolTip(this.txtPhysicalAdd, "Enter address"); toolTip1.SetToolTip(this.cbxProvince, "Select South African Province"); toolTip1.SetToolTip(this.cbxCity, "Select South African City"); toolTip1.SetToolTip(this.txtCreditAmount, "Enter credit amount"); toolTip1.SetToolTip(this.txtDateTimeDateOfCommencement, "Select date"); toolTip1.SetToolTip(this.btnBrowse, "Browse to upload credit approval"); toolTip1.SetToolTip(this.btnViewCreditApproval, "Click to view credit approval uploaded"); toolTip1.SetToolTip(this.btnAddClient, "Click to add client"); using (SPEntities db = new SPEntities()) { provinceBindingSource.DataSource = db.Provinces.ToList(); cityBindingSource.DataSource = db.Cities.ToList(); clientAccountStatusBindingSource.DataSource = db.Client_Account_Status.ToList(); creditStatusBindingSource.DataSource = db.Credit_Status.ToList(); } cbxAccountStatus.SelectedValue = -1; }
private void frmASale_Load(object sender, EventArgs e) { using (SPEntities db = new SPEntities()) { productBindingSource1.DataSource = db.Products.ToList(); } // TODO: This line of code loads data into the 'sPDataSet6.Product' table. You can move, or remove it, as needed. //this.productTableAdapter1.Fill(this.sPDataSet6.Product); // TODO: This line of code loads data into the 'sPDataSet5.Product' table. You can move, or remove it, as needed. //this.productTableAdapter.Fill(this.sPDataSet5.Product); if (CountSaleIDs() == 0) { txtSaleID.Text = "1"; } else { txtSaleID.Text = RetrieveLastSaleID().ToString(); } DataTable t = new DataTable(); t.Columns.Add("ProductID", typeof(Int32)); t.Columns.Add("Product Name", typeof(string)); t.Columns.Add("Product Quantity", typeof(Int32)); t.Columns.Add("Product Price", typeof(double)); t.Columns.Add("Total Price", typeof(double)); dgvSale.DataSource = t; }
public List <Product> ListAllProducts() { List <Product> list = new List <Product>(); using (var dbContext = new SPEntities()) { foreach (var item in dbContext.Products) { list.Add(item); } } return(list); }
public frmASale() { InitializeComponent(); using (var context = new SPEntities()) { var details = context.Products.ToList(); productBindingSource.DataSource = details; cbxProductDesc.DropDownStyle = ComboBoxStyle.DropDownList; cbxProductDesc.DisplayMember = "Product Description"; //cbxProductDesc.DataSource = details; } cbxProductDesc.SelectedIndex = -1; }
public frmMaintainClient(string client, string x) { ID = x; ClientID = Convert.ToInt32(client); InitializeComponent(); SPEntities db = new SPEntities(); Credit_Approval NewCA = new Credit_Approval(); Credit_Return NewReturn = new Credit_Return(); Province NewProv = new Province(); Client newClient = new Client(); byte[] FileData; string FName; }
private void frmMaintainClient_Load(object sender, EventArgs e) { toolTip1.SetToolTip(this.txtName, "Enter Client Name "); toolTip1.SetToolTip(this.txtVatRegNum, "Enter 10 digit Vat Registration number"); toolTip1.SetToolTip(this.txtTelephone, "Enter 10 digit telephone number"); toolTip1.SetToolTip(this.txtFaxNumber, "Enter 10 digit fax number number"); toolTip1.SetToolTip(this.txtEmailAdd, "Enter a valid email containing @"); toolTip1.SetToolTip(this.txtPhysicalAdd, "Enter address"); toolTip1.SetToolTip(this.cbxProvince, "Select South African Province"); toolTip1.SetToolTip(this.cbxCity, "Select South African City"); toolTip1.SetToolTip(this.txtCreditAmount, "Enter credit amount"); toolTip1.SetToolTip(this.cbxCreditStatus, "Select valid credit status"); toolTip1.SetToolTip(this.txtDateTimeDateOfCommencement, "Select date"); toolTip1.SetToolTip(this.cbxCreditStatus, "Select valid credit status"); toolTip1.SetToolTip(this.btnBrowse, "Browse to upload credit approval"); toolTip1.SetToolTip(this.btnDeleteClient, "Click to remove client"); toolTip1.SetToolTip(this.btnUpdateClient, "Click to edit client"); toolTip1.SetToolTip(this.btnDownload, "Click to obtain credit approval"); Credit_Approval NewCA = new Credit_Approval(); try { NewCA = db.Credit_Approval.Find(Convert.ToInt32(ClientID)); int Approvalid; Approvalid = Convert.ToInt32(NewCA.Credit_Approval_ID); Credit_Approval ret = db.Credit_Approval.Find(Approvalid); txtFilePath.Text = Convert.ToString(ret.Credit_Approval_Form); var query = db.Clients.Where(co => co.Client_ID == ClientID).FirstOrDefault(); var query1 = db.Provinces.Where(co => co.Province_Id == query.Province_Id).FirstOrDefault(); var query2 = db.Cities.Where(co => co.City_Id == query.City_Id).FirstOrDefault(); var query3 = db.Credit_Approval.Where(co => co.Credit_Approval_ID == query.Credit_Approval_ID).FirstOrDefault(); var query4 = db.Credit_Status.Where(co => co.Credit_Status_ID == query3.Credit_Status_ID).FirstOrDefault(); var query5 = db.Client_Account_Status.Where(co => co.Account_Status_ID == query.Account_Status_ID).FirstOrDefault(); //var qu = db.Provinces.Select(x => x.Province_Name).ToList(); //txtProvince.DataSource = qu; //txtProvince.DropDownStyle = ComboBoxStyle.DropDownList; //var qu1 = db.Cities.Select(x => x.City_Name).ToList(); //txtCity.DataSource = qu1; //txtCity.DropDownStyle = ComboBoxStyle.DropDownList; //var qu2 = db.Credit_Status.Select(x => x.Credit_Status_Description).ToList(); //txtCreditSta.DataSource = qu2; //txtCreditSta.DropDownStyle = ComboBoxStyle.DropDownList; //var qu3 = db.Client_Account_Status.Select(x => x.Account_Status_Description).ToList(); //txtAccountStatus.DataSource = qu3; //txtAccountStatus.DropDownStyle = ComboBoxStyle.DropDownList; txtName.Text = query.Client_Name; txtVatRegNum.Text = query.Client_VAT_Reg_Number; txtTelephone.Text = query.Client_Telephone; txtFaxNumber.Text = query.Client_Fax_Number; txtEmailAdd.Text = query.Client_Email_Address; txtPhysicalAdd.Text = query.Physical_Address; cbxProvince.Text = query1.Province_Name; cbxCity.Text = query2.City_Name; if (query3.Credit_Status_ID == null) { cbxCreditStatus.SelectedIndex = -1; } else { cbxCreditStatus.Text = query4.Credit_Status_Description; } if (query3.Credit_Approval_Form == null) { txtFilePath.Text = ""; btnDownload.Visible = false; } else { txtFilePath.Text = Convert.ToBase64String(query3.Credit_Approval_Form); btnDownload.Visible = true; } comboBox5.Text = query5.Account_Status_Description; txtCreditAmount.Text = Convert.ToString(query3.Credit_Approval_Amount); txtDateTimeDateOfCommencement.MinDate = Convert.ToDateTime(query3.Date_Of_Commencement); comboBox5.Text = Convert.ToString(query.Client_Account_Status); txtFilePath.Text = Convert.ToString(query3.Credit_Approval_Form); // NewCA = db.Credit_Approval.Find(Convert.ToInt32(CAid)); int CreditAppid; CreditAppid = Convert.ToInt32(NewCA.Credit_Approval_ID); //if (NewCA.Credit_Approval_Form == null) //{ // btnDownload.Visible = false; //} using (SPEntities db = new SPEntities()) { provinceBindingSource.DataSource = db.Provinces.ToList(); cityBindingSource.DataSource = db.Cities.ToList(); clientAccountStatusBindingSource.DataSource = db.Client_Account_Status.ToList(); creditStatusBindingSource.DataSource = db.Credit_Status.ToList(); } } catch { } }