private void Customer_Load(object sender, EventArgs e) { //DataTable dt = dbMainClass.getDetails("CustomerDetails"); List <string> ds = new List <string>(); ds.Add("Name"); ds.Add("COMPNAME"); ds.Add("ADDRESS"); ds.Add("CITY"); ds.Add("STATE"); ds.Add("ZIP"); ds.Add("COUNTRY"); ds.Add("EMAIL"); ds.Add("WEBADDRESS"); ds.Add("PHONE"); ds.Add("MOBILE"); ds.Add("FAX"); ds.Add("DESC"); ds.Add("OPENINGBALANCE"); ds.Add("CURRENTBALANCE"); ds.Add("PanNo"); ds.Add("TanNo"); ds.Add("Others"); comserchvalue.DataSource = ds; panel1.Visible = false; string Id = dbMainClass.getUniqueID("Customerdetail"); txtCustCode.Text = Id; if (Id == "C0001") { btnList.Enabled = false; } else { btnList.Enabled = true; } }
private void Item_Load(object sender, EventArgs e) { string selectqurry = "select itm.ItemName,itm.ItemCompName,itm.ItemDesc,itm.groupid,itm.Unitid,ipd.purChasePrice,ipd.SalesPrice,ipd.MrpPrice,ipd.Margin,iqd.OpeningQuantity,iqd.CurrentQuantity from ItemDetails itm join ItemPriceDetail ipd on itm.itemid=ipd.itemid join ItemQuantityDetail iqd on ipd.itemid=iqd.itemid"; DataTable dt = dbMainClass.getDetailByQuery(selectqurry); List <string> ls = new List <string>(); DataColumnCollection d = dt.Columns; for (int a = 0; a < d.Count; a++) { //DataColumn dc = new DataColumn(); string b = d[a].ToString(); ls.Add(b); } searchCalmn.DataSource = ls; panel1.Visible = false; string Id = dbMainClass.getUniqueID("ItemDetails"); txtItemProductCode.Text = Id; if (Id == "l0001") { btnItemList.Enabled = false; } else { btnItemList.Enabled = true; } //setID(); string selectCommandGroup = "select groupID,GROUPNAME,GROUPDESC from dbo.ItemGroup"; setItemGroupDetail(selectCommandGroup, cmbItemItemGroup, "Group"); string selectCommandUnit = "select unitID,unitName,unitDESC from dbo.ItemUnitList"; setItemGroupDetail(selectCommandUnit, cmbItemUnit, "Unit"); }
private void ItemGroup_Load(object sender, EventArgs e) { string ColumnID = dbMainClass.getUniqueID("GROUP"); txtGroupID.Text = ColumnID; }
private void Unit_Load(object sender, EventArgs e) { string ColumnID = dbMainClass.getUniqueID("UNIT"); txtUnitId.Text = ColumnID; }
/// <summary> /// To Save Details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnVenderSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtVenderName.Text)) { MessageBox.Show("please Enter the name"); } else { if (string.IsNullOrEmpty(txtCompanyName.Text)) { MessageBox.Show("please Enter the Company name"); } else { if (string.IsNullOrEmpty(txtVenderAddress.Text)) { MessageBox.Show("please Enter the Address"); } else { //if (string.IsNullOrEmpty(txtVenderPhone.Text) && string.IsNullOrEmpty(txtVenderMobile.Text)) //{ // MessageBox.Show("please Enter the Mobile No. ya Phone No."); //} //else //{ // if (!this.txtVenderEmailAddress.Text.Contains('@') || !this.txtVenderEmailAddress.Text.Contains('.')) // { // MessageBox.Show("Please Enter the Correct Email Address"); // } // else // { //if (!this.txtVenderWebSite.Text.Contains('@') || !this.txtVenderWebSite.Text.Contains('.') || !this.txtVenderWebSite.Text.Contains("http://")) //{ // MessageBox.Show("Please Enter the Correct Web Site Address"); ////} //else //{ if (updateCounter == 0) { string saveCommand1 = "insert into VendorDetails values ('" + txtVenderCode.Text + "','" + txtVenderName.Text + "','" + txtCompanyName.Text + "','" + txtVenderAddress.Text + "','" + txtVenderCity.Text + "','" + txtVenderState.Text + "','" + txtVenderZip.Text + "','" + txtVenderCountry.Text + "','" + txtVenderEmailAddress.Text + "','" + txtVenderWebSite.Text + "','" + txtVenderPhone.Text + "', '" + txtVenderMobile.Text + "','" + txtVenderFax.Text + "','" + txtVenderDesc.Text + "','" + txtPanNo.Text + "','" + txtTinNo.Text + "','" + txtOther.Text + "')"; string saveCommand2 = "insert into VendorAccountDetails values ('" + txtVenderCode.Text + "','" + txtVenderCode.Text + "','" + txtVenderOpeningBal.Text + "','" + txtVenderCurrentBal.Text + "')"; int insertedRows = dbMainClass.saveDetails(saveCommand1, saveCommand2); if (insertedRows > 0) { btnVenderList.Enabled = true; MessageBox.Show("Details Saved Successfully"); txtVenderName.Focus(); } else { MessageBox.Show("Details Not Saved Successfully"); } } else if (updateCounter == 1) { string updateCommand1 = "update VendorDetails set vName='" + txtVenderName.Text + "', vCompName= '" + txtCompanyName.Text + "',vAddress='" + txtVenderAddress.Text + "',vCity='" + txtVenderCity.Text + "',vState='" + txtVenderState.Text + "',vZip='" + txtVenderZip.Text + "',vCountry='" + txtVenderCountry.Text + "',vEmail='" + txtVenderEmailAddress.Text + "',vWebAddress='" + txtVenderWebSite.Text + "',vPhone='" + txtVenderPhone.Text + "', vMobile='" + txtVenderMobile.Text + "',vFax='" + txtVenderFax.Text + "',vPanNo='" + txtPanNo.Text + "',vTinNo='" + txtTinNo.Text + "',vDesc='" + txtVenderDesc.Text + "',vOther='" + txtOther.Text + "' where venderid='" + txtVenderCode.Text + "'"; string updateCommand2 = "update VendorAccountDetails set vOpeningBalance='" + txtVenderOpeningBal.Text + "',vCurrentBalance='" + txtVenderCurrentBal.Text + "' where venderId='" + txtVenderCode.Text + "'"; int updatedRows = dbMainClass.updateDetails(updateCommand1, updateCommand2); if (updatedRows > 0) { txtVenderName.Focus(); MessageBox.Show("Details Updated Successfully"); } else { MessageBox.Show("Details Can not updated"); } updateCounter = 0; } makeBlank(); Enabled2(); string Id = dbMainClass.getUniqueID("VENDOR"); txtVenderCode.Text = Id; //} //} } } } }