private void btnSearch_Click(object sender, EventArgs e) { int published, promID; string promName; if (txtPromID.Text.ToString() != "") { promID = Int32.Parse(txtPromID.Text.ToString()); } else { promID = 0; } promName = txtPromName.Text.ToString(); if (chkActive.Checked) { published = 1; } else { published = 0; } this.promotionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString(); //when dataAdapter fill the dataset, query was written in PMO006STGDataSet.xsd file. this.promotionTableAdapter.FillBy(this.pMO006STGDataSet.promotion, promID, promName, published); }
private void frmPromotionLookup_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'pMO006STGDataSet.promotion' table. You can move, or remove it, as needed. this.Text = this.Text + " - " + MetriconCommon.WindowTitleInfo; this.promotionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString(); //when dataAdapter fill the dataset, query was written in PMO006STGDataSet.xsd file. this.promotionTableAdapter.Fill(this.pMO006STGDataSet.promotion); // classCustomizeScreenLookAndFeel.customizeMyScreen(this); }
private void frmHomeDisplayLookup_Load(object sender, EventArgs e) { this.Text = this.Text + " - " + MetriconCommon.WindowTitleInfo; this.homeTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString(); //when dataAdapter fill the dataset, query was written in PMO006STGDataSet.xsd file. //this.homeTableAdapter.FillHomeDisplayData(this.pMO006STGDataSet.Home); loadStateDropdown(); LoadBrandList(); loadStatusDropdown(); fillByToolStripButton_Click(sender, e); // classCustomizeScreenLookAndFeel.customizeMyScreen(this); }
private void frmHomeLookup_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'pMO006STGDataSet.Home' table. You can move, or remove it, as needed. this.Text = this.Text + " - " + MetriconCommon.WindowTitleInfo; this.homeTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString(); //this.homeTableAdapter.Fill(this.pMO006STGDataSet.Home); loadStateDropdown(); LoadBrandList(); loadStatusDropdown(); loadShowOnPriceListDropdown(); fillByToolStripButton_Click(sender, e); // classCustomizeScreenLookAndFeel.customizeMyScreen(this); }
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { int active, active2, qty; bool so, si, changeprice, changeqty, addextradesc; qty = 0; try { if (dataGridView1.Rows.Count != 0) { this.adminSearchHomeDisplayOptionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString(); DataRow modifiedRow = ((DataRowView)this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row; DataSet dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("select active from homedisplayoption_Staging where productareagroupid=" + modifiedRow["productareagroupid"].ToString() + " and homeid=" + modifiedRow["homeid"].ToString()); if (dsHome.Tables[0].Rows[0][0].ToString() == "False") { active = 0; } else { active = 1; } if (modifiedRow["active"].ToString() == "True") { active2 = 1; } else { active2 = 0; } //modifiedRow["EnterDesc"] = "Note: Stained finish to KDHW components on this stair are non-standard and cannot be offered." + DateTime.Now.ToLongTimeString(); if (modifiedRow["standardoption"] != null && modifiedRow["standardoption"].ToString().ToUpper() == "TRUE") { so = true; } else { so = false; } if (modifiedRow["standardinclusion"] != null && modifiedRow["standardinclusion"].ToString().ToUpper() == "TRUE") { si = true; } else { si = false; } if (modifiedRow["changeqty"] != null && modifiedRow["changeqty"].ToString().ToUpper() == "TRUE") { changeqty = true; } else { changeqty = false; } if (modifiedRow["addextradesc"] != null && modifiedRow["addextradesc"].ToString().ToUpper() == "TRUE") { addextradesc = true; } else { addextradesc = false; } if (modifiedRow["changeprice"] != null && modifiedRow["changeprice"].ToString().ToUpper() == "TRUE") { changeprice = true; } else { changeprice = false; } if (active != active2) { dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("[AdminEditHDO]", new System.Data.SqlClient.SqlParameter[12] { new System.Data.SqlClient.SqlParameter("@StandardOption", so), new System.Data.SqlClient.SqlParameter("@GeneralOption", false), new System.Data.SqlClient.SqlParameter("@StandardInclusion", si), new System.Data.SqlClient.SqlParameter("@Quantity", qty), new System.Data.SqlClient.SqlParameter("@ModifiedDate", "01/01/06"), new System.Data.SqlClient.SqlParameter("@ModifiedBy", MetriconCommon.UserCode), new System.Data.SqlClient.SqlParameter("@Active", active2), new System.Data.SqlClient.SqlParameter("@ChangeQty", changeqty), new System.Data.SqlClient.SqlParameter("@AddExtraDesc", addextradesc), new System.Data.SqlClient.SqlParameter("@EnterDesc", "none"), new System.Data.SqlClient.SqlParameter("@ChangePrice", changeprice), new System.Data.SqlClient.SqlParameter("@OptionID", Int32.Parse(modifiedRow["optionID"].ToString())), } ); //modifiedRow["ModifiedBy"] = MetriconCommon.UserCode; //modifiedRow["ModifiedDate"] = DateTime.Now.ToString(); //this.adminSearchHomeDisplayOptionTableAdapter.Update(modifiedRow); } } } catch (IndexOutOfRangeException ex1) { //MessageBox.Show(ex1.Message.ToString()); } catch (Exception ex2) { MessageBox.Show(ex2.Message.ToString()); } }
private void frmDisplayHomeDisplayOption_Load(object sender, EventArgs e) { this.adminSearchHomeDisplayOptionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString(); btnSearchDisHomeID_Click(sender, e); loadArea(); loadGroup(); if (txtDisHomeID.Text.ToString() != "") { loadPAGList(); loadPAGList2(); LoadDisplayHomeDetails(); } this.listView2.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView2_ItemChecked); // classCustomizeScreenLookAndFeel.customizeMyScreen(this); }
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { string enterdesc = ""; int active, active2; decimal qty; qty = 0; bool so, si, changeqty, changeprice, addextradesc; try { if (dataGridView1.Rows.Count != 0) { this.adminSearchHomeDisplayOptionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString(); DataRow modifiedRow = ((DataRowView)this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row; DataSet dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("select active from homedisplayoption_Staging where productareagroupid=" + modifiedRow["productareagroupid"].ToString() + " and homeid=" + modifiedRow["homeid"].ToString() + " and homedisplayid=" + modifiedRow["homedisplayid"].ToString()); if (dsHome.Tables[0].Rows[0][0].ToString() == "False") { active = 0; } else { active = 1; } if (modifiedRow["active"].ToString() == "True") { active2 = 1; } else { active2 = 0; } //modifiedRow["EnterDesc"] = "Note: Stained finish to KDHW components on this stair are non-standard and cannot be offered." + DateTime.Now.ToLongTimeString(); if (modifiedRow["EnterDesc"] != null && modifiedRow["EnterDesc"].ToString() != "") { enterdesc = modifiedRow["EnterDesc"].ToString(); } if (modifiedRow["quantity"] != null && modifiedRow["quantity"].ToString() != "") { try { qty = decimal.Parse(modifiedRow["quantity"].ToString()); } catch (Exception ex) { MessageBox.Show("Quantity should be a number."); return; } } if (modifiedRow["standardoption"] != null && modifiedRow["standardoption"].ToString().ToUpper() == "TRUE") { so = true; } else { so = false; } if (modifiedRow["standardinclusion"] != null && modifiedRow["standardinclusion"].ToString().ToUpper() == "TRUE") { si = true; } else { si = false; } if (modifiedRow["changeqty"] != null && modifiedRow["changeqty"].ToString().ToUpper() == "TRUE") { changeqty = true; } else { changeqty = false; } if (modifiedRow["addextradesc"] != null && modifiedRow["addextradesc"].ToString().ToUpper() == "TRUE") { addextradesc = true; } else { addextradesc = false; } if (modifiedRow["changeprice"] != null && modifiedRow["changeprice"].ToString().ToUpper() == "TRUE") { changeprice = true; } else { changeprice = false; } if (active != active2) { var confirmResult = MessageBox.Show("Are you sure to delete this item ?", "Confirm Delete!!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("[AdminEditHDO]", new System.Data.SqlClient.SqlParameter[12] { new System.Data.SqlClient.SqlParameter("@StandardOption", so), new System.Data.SqlClient.SqlParameter("@GeneralOption", false), new System.Data.SqlClient.SqlParameter("@StandardInclusion", si), new System.Data.SqlClient.SqlParameter("@Quantity", qty), new System.Data.SqlClient.SqlParameter("@ModifiedDate", DateTime.Now), new System.Data.SqlClient.SqlParameter("@ModifiedBy", MetriconCommon.UserCode), new System.Data.SqlClient.SqlParameter("@Active", active2), new System.Data.SqlClient.SqlParameter("@ChangeQty", changeqty), new System.Data.SqlClient.SqlParameter("@AddExtraDesc", addextradesc), new System.Data.SqlClient.SqlParameter("@EnterDesc", enterdesc), new System.Data.SqlClient.SqlParameter("@ChangePrice", changeprice), new System.Data.SqlClient.SqlParameter("@OptionID", Int32.Parse(modifiedRow["optionID"].ToString())), } ); dataGridView1.Rows.RemoveAt(e.RowIndex); } else { modifiedRow["active"] = "True"; return; } } else { dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("[AdminEditHDO]", new System.Data.SqlClient.SqlParameter[12] { new System.Data.SqlClient.SqlParameter("@StandardOption", so), new System.Data.SqlClient.SqlParameter("@GeneralOption", false), new System.Data.SqlClient.SqlParameter("@StandardInclusion", si), new System.Data.SqlClient.SqlParameter("@Quantity", qty), new System.Data.SqlClient.SqlParameter("@ModifiedDate", DateTime.Now), new System.Data.SqlClient.SqlParameter("@ModifiedBy", MetriconCommon.UserCode), new System.Data.SqlClient.SqlParameter("@Active", active2), new System.Data.SqlClient.SqlParameter("@ChangeQty", changeqty), new System.Data.SqlClient.SqlParameter("@AddExtraDesc", addextradesc), new System.Data.SqlClient.SqlParameter("@EnterDesc", enterdesc), new System.Data.SqlClient.SqlParameter("@ChangePrice", changeprice), new System.Data.SqlClient.SqlParameter("@OptionID", Int32.Parse(modifiedRow["optionID"].ToString())), } ); } } } catch (IndexOutOfRangeException ex1) { //MessageBox.Show(ex1.Message.ToString()); } catch (Exception ex2) { MessageBox.Show(ex2.Message.ToString()); } }
public void SetConnectionString() { this.sSQLConnectionString = MetriconCommon.getConnectionString(); }