private void FillCampComboBox(string strCompCode, string strBranCode) { objServicedb = new ServiceDeptDB(); cbCamps.DataSource = null; if (strCompCode.Length > 0 && strBranCode.Length > 0) { try { DataTable dt = objServicedb.LevelCampList_Get(strCompCode, strBranCode, "T").Tables[0]; DataRow dr = dt.NewRow(); dr[0] = "--Select--"; dr[1] = "--Select--"; dt.Rows.InsertAt(dr, 0); if (dt.Rows.Count > 1) { cbCamps.DataSource = dt; cbCamps.DisplayMember = "CAMP_NAME"; cbCamps.ValueMember = "CAMP_CODE"; } dt = null; } catch (Exception ex) { MessageBox.Show(ex.Message, "Product Promotion", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { objServicedb = null; } } }
private void GetProdPromotionDetails() { objServicedb = new ServiceDeptDB(); DataTable dtProdPrmHead; Hashtable ht; if (txtTrnNo.Text.Length > 21) { try { ht = objServicedb.GetProductPromotionDetails(txtTrnNo.Text.ToString()); dtProdPrmHead = (DataTable)ht["ProdPromHead"]; FillHeadDetails(dtProdPrmHead); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { objServicedb = null; ht = null; } } }
private void FillEmployeeData() { objServiceDB = new ServiceDeptDB(); DataTable dt = new DataTable(); gvEmpDetails.Rows.Clear(); try { dt = objServiceDB.GetServiceMappedEcodes(CommonData.CompanyCode, CommonData.BranchCode, dtpDocMonth.Value.ToString("MMMyyyy")).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { gvEmpDetails.Rows.Add(); gvEmpDetails.Rows[i].Cells["SLNO"].Value = (i + 1).ToString(); gvEmpDetails.Rows[i].Cells["Ecode"].Value = dt.Rows[i]["ECODE"].ToString(); gvEmpDetails.Rows[i].Cells["EmpName"].Value = dt.Rows[i]["ENAME"].ToString(); gvEmpDetails.Rows[i].Cells["Desig"].Value = dt.Rows[i]["desig_name"].ToString(); gvEmpDetails.Rows[i].Cells["Dept"].Value = dt.Rows[i]["dept_name"].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { objServiceDB = null; dt = null; } }
public void GetServiceEmpActivities() { objServicedb = new ServiceDeptDB(); DataTable dt = new DataTable(); try { dt = objServicedb.GetServiceEmpActivities(sCompCode, sBranchCode, sDocMonth, strEcode, Convert.ToDateTime(dtpActivityDate.Value).ToString("dd/MMM/yyyy")).Tables[0]; if (dt.Rows.Count > 0) { DataRow row = dt.NewRow(); row["ActivityName"] = "--Select--"; row["TranNo"] = "--Select--"; dt.Rows.InsertAt(row, 0); cbActivityTypes.DataSource = dt; cbActivityTypes.DisplayMember = "ActivityName"; cbActivityTypes.ValueMember = "TranNo"; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { objServicedb = null; dt = null; } }
private void GetInvoiceVerificationDetails() { objDB = new ServiceDeptDB(); Hashtable ht = new Hashtable(); DataTable dtHead = new DataTable(); DataTable dtDetl = new DataTable(); gvInvVerificationDetl.Rows.Clear(); if (cbBranch.SelectedIndex > 0 && txtOrderNo.Text.Length > 0) { try { ht = objDB.Get_InvoiceVerificationDetl(cbCompany.SelectedValue.ToString(), cbBranch.SelectedValue.ToString().Split('@')[0], dtpDocMonth.Value.ToString("MMMyyyy").ToUpper(), txtOrderNo.Text.ToString()); dtHead = (DataTable)ht["InvVerificationHead"]; dtDetl = (DataTable)ht["InvVerificationDetl"]; if (dtHead.Rows.Count > 0) { txtSrEcode.Text = dtHead.Rows[0]["SREcode"].ToString(); txtSRName.Text = dtHead.Rows[0]["SRName"].ToString();; txtVerifiedBy.Text = dtHead.Rows[0]["AoEcode"].ToString(); txtVerifiedName.Text = dtHead.Rows[0]["AoName"].ToString(); txtGLEcode.Text = dtHead.Rows[0]["GroupEcode"].ToString(); txtGLName.Text = dtHead.Rows[0]["GLName"].ToString(); txtCampName.Text = dtHead.Rows[0]["CampName"].ToString(); if (dtDetl.Rows.Count > 0) { for (int i = 0; i < dtDetl.Rows.Count; i++) { gvInvVerificationDetl.Rows.Add(); gvInvVerificationDetl.Rows[i].Cells["SlNO"].Value = (i + 1).ToString(); gvInvVerificationDetl.Rows[i].Cells["Observation_Code"].Value = dtDetl.Rows[i]["Observ_Code"].ToString(); gvInvVerificationDetl.Rows[i].Cells["Observation_Desc"].Value = dtDetl.Rows[i]["Oberv_Desc"].ToString(); gvInvVerificationDetl.Rows[i].Cells["Remarks"].Value = dtDetl.Rows[i]["Remarks"].ToString(); } } } else { txtSrEcode.Text = ""; txtSRName.Text = ""; //txtVerifiedBy.Text = ""; //txtVerifiedName.Text = ""; txtGLEcode.Text = ""; txtGLName.Text = ""; txtCampName.Text = ""; gvInvVerificationDetl.Rows.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void FillCustomerFarmerData() { DataSet ds = null; objServicedb = new ServiceDeptDB(); try { if (txtVillage.Text != "") { Cursor.Current = Cursors.WaitCursor; ds = new DataSet(); ds = objServicedb.CustomersInVillage_Get(txtVillage.Text, txtMandal.Text, txtDistrict.Text, txtState.Text); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 1) { txtFarmerName.Text = dt.Rows[0]["CUSTOMER_NAME"] + ""; cbRelation.Text = dt.Rows[0]["SO_FO"] + ""; txtRelationName.Text = dt.Rows[0]["FORG_NAME"] + ""; txtMobileNo.Text = dt.Rows[0]["MOBILE"] + ""; } else if (dt.Rows.Count > 1) { FillCustomerComboBox(dt); } else { cbFarmers.DataSource = null; cbFarmers.DataBindings.Clear(); cbFarmers.Items.Clear(); txtFarmerName.Text = ""; txtRelationName.Text = ""; txtMobileNo.Text = ""; } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { objServicedb = null; ds.Dispose(); Cursor.Current = Cursors.Default; } }
private void FillSourceComboBox() { objServdb = new ServiceDeptDB(); DataTable dt = new DataTable(); string[] strDestCode = ((NewCheckboxListItem)(clbDestination.SelectedItem)).Tag.Split('~'); clbSource.Items.Clear(); try { dt = objServdb.LevelGroupServiceEcodes_Get(strBranch, Convert.ToInt32(strDestCode[0]), Convert.ToDateTime(dtpDocMonth.Value).ToString("MMMyyyy").ToUpper()).Tables[0]; if (dt.Rows.Count > 0) { foreach (DataRow dataRow in dt.Rows) { if (dataRow["Mapped"].ToString() == "99999") { NewCheckboxListItem oclBox = new NewCheckboxListItem(); oclBox.Tag = dataRow["ECODE"].ToString(); oclBox.Text = dataRow["ENAME"].ToString(); clbSource.Items.Add(oclBox); oclBox = null; } else { NewCheckboxListItem oclBox = new NewCheckboxListItem(); oclBox.Tag = dataRow["ECODE"].ToString(); oclBox.Text = dataRow["ENAME"].ToString(); clbSource.Items.Add(oclBox, CheckState.Checked); oclBox = null; } } } dt = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { objServdb = null; } }
private void FillAddressData(string svilsearch) { objServicedb = new ServiceDeptDB(); DataTable dtVillage = new DataTable(); if (txtVillage.Text != "") { try { dtVillage = objServicedb.ServiceVillageSearch_Get(svilsearch).Tables[0]; if (dtVillage.Rows.Count > 0) { for (int i = 0; i < dtVillage.Rows.Count; i++) { if (txtVillage.Text.Equals(dtVillage.Rows[i]["PANCHAYAT"].ToString())) { txtMandal.Text = dtVillage.Rows[0]["Mandal"].ToString(); txtDistrict.Text = dtVillage.Rows[0]["District"].ToString(); txtState.Text = dtVillage.Rows[0]["State"].ToString(); txtPin.Text = dtVillage.Rows[0]["PIN"].ToString(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { objServicedb = null; dtVillage = null; } } else { txtMandal.Text = ""; txtDistrict.Text = ""; txtState.Text = ""; txtPin.Text = ""; } }
private void EcodeSearch() { objServicedb = new ServiceDeptDB(); DataSet dsEmp = null; if (cbBranches.SelectedIndex > 0) { try { string[] strBranCode = cbBranches.SelectedValue.ToString().Split('@'); Cursor.Current = Cursors.WaitCursor; cbEcode.DataSource = null; cbEcode.Items.Clear(); dsEmp = objServicedb.ServiceLevelEcodeSearch_Get(cbCompany.SelectedValue.ToString(), strBranCode[0], CommonData.DocMonth, txtEcodeSearch.Text.ToString()); DataTable dtEmp = dsEmp.Tables[0]; if (dtEmp.Rows.Count > 0) { cbEcode.DataSource = dtEmp; cbEcode.DisplayMember = "ENAME"; cbEcode.ValueMember = "ECODE"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (cbEcode.SelectedIndex > -1) { cbEcode.SelectedIndex = 0; strECode = ((System.Data.DataRowView)(cbEcode.SelectedItem)).Row.ItemArray[0].ToString(); } objServicedb = null; Cursor.Current = Cursors.Default; } } }
private void FillFaremerMeetingDetailsToGrid() { objServiceDB = new ServiceDeptDB(); DataTable dt = new DataTable(); string strCompCode = cbCompany.SelectedValue.ToString(); string strBranchCode = cbBranches.SelectedValue.ToString(); gvTransactionDetails.Rows.Clear(); try { dt = objServiceDB.ServiceFarmerMeetingDetails(strCompCode, strBranchCode, Convert.ToDateTime(dtpDocMonth.Value).ToString("MMMyyyy").ToUpper(), "SUMMARY").Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { gvTransactionDetails.Rows.Add(); gvTransactionDetails.Rows[i].Cells["SLNO"].Value = (i + 1).ToString(); gvTransactionDetails.Rows[i].Cells["TrnNo"].Value = dt.Rows[i]["SFMH_TRN_NUMBER"].ToString(); gvTransactionDetails.Rows[i].Cells["ConductedBy"].Value = dt.Rows[i]["EmpName"].ToString(); gvTransactionDetails.Rows[i].Cells["CampName"].Value = dt.Rows[i]["SFMH_CAMP_NAME"].ToString(); gvTransactionDetails.Rows[i].Cells["ProductsCnt"].Value = dt.Rows[i]["ProdCount"].ToString(); gvTransactionDetails.Rows[i].Cells["DemosCnt"].Value = dt.Rows[i]["SFMP_DEMOS_COUNT"].ToString(); gvTransactionDetails.Rows[i].Cells["OthersCnt"].Value = dt.Rows[i]["SFMP_FARMERS_COUNT"].ToString(); gvTransactionDetails.Rows[i].Cells["CompanyStaffCnt"].Value = dt.Rows[i]["CompanyStaff"].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { objServiceDB = null; dt = null; } }
private void FillMappList() { objServdb = new ServiceDeptDB(); char cMapped = 'T'; DataTable dt = new DataTable(); lbMapp.DataSource = null; try { if (chkMapp.CheckState == CheckState.Unchecked) { cMapped = 'F'; lblMap.Text = "Unmapped Source"; } else { lblMap.Text = "Mapped Source"; } dt = objServdb.Get_ServiceMaporUnmappedEcodes(strBranch, Convert.ToDateTime(dtpDocMonth.Value).ToString("MMMyyyy").ToUpper(), cMapped).Tables[0]; if (dt.Rows.Count > 0) { lbMapp.DataSource = dt; lbMapp.DisplayMember = "ENAME"; lbMapp.ValueMember = "ECODE"; } dt = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { objServdb = null; } }
private void FillEmployeeData(string sCompCode, string sBranCode) { objServicedb = new ServiceDeptDB(); DataSet dsEmp = null; if (sCompCode.Length > 0 && sBranCode.Length > 0) { try { Cursor.Current = Cursors.WaitCursor; cbEcode.DataSource = null; cbEcode.Items.Clear(); dsEmp = objServicedb.ServiceLevelEcodeSearch_Get(sCompCode, sBranCode, CommonData.DocMonth, txtEcodeSearch.Text.ToString()); DataTable dtEmp = dsEmp.Tables[0]; if (dtEmp.Rows.Count > 0) { cbEcode.DataSource = dtEmp; cbEcode.DisplayMember = "ENAME"; cbEcode.ValueMember = "ECODE"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (cbEcode.SelectedIndex > -1) { cbEcode.SelectedIndex = 0; strECode = ((System.Data.DataRowView)(cbEcode.SelectedItem)).Row.ItemArray[0].ToString(); } objServicedb = null; Cursor.Current = Cursors.Default; } } }
private void FillEmployeeData() { objServicedb = new ServiceDeptDB(); DataSet dsEmp = null; try { //string[] strBranCode = cbBranches.SelectedValue.ToString().Split('@'); Cursor.Current = Cursors.WaitCursor; cbEcode.DataSource = null; cbEcode.Items.Clear(); dsEmp = objServicedb.Get_EcodesforService(); DataTable dtEmp = dsEmp.Tables[0]; if (dtEmp.Rows.Count > 0) { cbEcode.DataSource = dtEmp; cbEcode.DisplayMember = "ENAME"; cbEcode.ValueMember = "ECODE"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (cbEcode.SelectedIndex > -1) { cbEcode.SelectedIndex = 0; strECode = ((System.Data.DataRowView)(cbEcode.SelectedItem)).Row.ItemArray[0].ToString(); } objServicedb = null; Cursor.Current = Cursors.Default; } }
//private bool FindInputAddressSearch() //{ // bool blFind = false; // try // { // for (int i = 0; i < this.cbVillage.Items.Count; i++) // { // string strItem = ((System.Data.DataRowView)(this.cbVillage.Items[i])).Row.ItemArray[1] + "".ToString().Trim(); // if (strItem.IndexOf(txtVillSearch.Text) > -1) // { // blFind = true; // cbVillage.SelectedIndex = i; // txtVillage.Text = ((System.Data.DataRowView)(this.cbVillage.Items[i])).Row.ItemArray[1] + ""; // txtMandal.Text = ((System.Data.DataRowView)(this.cbVillage.Items[i])).Row.ItemArray[2] + ""; // txtDistrict.Text = ((System.Data.DataRowView)(this.cbVillage.Items[i])).Row.ItemArray[3] + ""; // txtState.Text = ((System.Data.DataRowView)(this.cbVillage.Items[i])).Row.ItemArray[4] + ""; // txtPin.Text = ((System.Data.DataRowView)(this.cbVillage.Items[i])).Row.ItemArray[5] + ""; // break; // } // break; // } // } // catch (Exception ex) // { // MessageBox.Show(ex.Message.ToString()); // } // finally // { // } // return blFind; //} private void FillAddressData(string svilsearch) { Hashtable htParam = null; objServicedb = new ServiceDeptDB(); string strDist = string.Empty; DataSet dsVillage = null; DataTable dtVillage = new DataTable(); if (txtVillSearch.Text != "") { try { Cursor.Current = Cursors.WaitCursor; if (svilsearch.Trim().Length >= 0) { htParam = new Hashtable(); } htParam.Add("sVillage", svilsearch); htParam.Add("sDistrict", strDist); htParam.Add("sCDState", CommonData.StateCode); dsVillage = new DataSet(); dsVillage = objServicedb.GetVillageDataSet(htParam); dtVillage = dsVillage.Tables[0]; if (dtVillage.Rows.Count == 1) { txtVillage.Text = dtVillage.Rows[0]["PANCHAYAT"].ToString(); txtMandal.Text = dtVillage.Rows[0]["Mandal"].ToString(); txtDistrict.Text = dtVillage.Rows[0]["District"].ToString(); txtState.Text = dtVillage.Rows[0]["State"].ToString(); txtPin.Text = dtVillage.Rows[0]["PIN"].ToString(); } else if (dtVillage.Rows.Count > 1) { txtVillage.Text = ""; txtMandal.Text = ""; txtDistrict.Text = ""; txtState.Text = ""; txtPin.Text = ""; FillAddressComboBox(dtVillage); } else { htParam = new Hashtable(); htParam.Add("sVillage", "%" + svilsearch); htParam.Add("sDistrict", strDist); dsVillage = new DataSet(); dsVillage = objServicedb.GetVillageDataSet(htParam); dtVillage = dsVillage.Tables[0]; FillAddressComboBox(dtVillage); } Cursor.Current = Cursors.Default; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { objServicedb = null; Cursor.Current = Cursors.Default; } } else { txtVillage.Text = ""; txtMandal.Text = ""; txtDistrict.Text = ""; txtState.Text = ""; txtPin.Text = ""; } }
private void FillHeadDetails(DataTable dtHead) { objServicedb = new ServiceDeptDB(); Hashtable ht; DataTable dtEmpDetails; DataTable dtProdItemDetl; if (txtTrnNo.Text.Length > 21) { try { ht = objServicedb.GetProductPromotionDetails(txtTrnNo.Text.ToString()); dtEmpDetails = (DataTable)ht["AttendentEmpDetails"]; dtProdItemDetl = (DataTable)ht["ProdItemDetails"]; if (dtHead.Rows.Count > 0) { flagUpdate = true; string stECode = dtHead.Rows[0]["Ecode"] + ""; cbCompany.SelectedValue = dtHead.Rows[0]["CompCode"].ToString();; cbBranches.SelectedValue = dtHead.Rows[0]["BranCode"].ToString(); dtpTrnDate.Value = Convert.ToDateTime(dtHead.Rows[0]["TrnDate"].ToString()); cbEcode.SelectedValue = stECode; txtEcodeSearch.Text = stECode; txtHouseNo.Text = dtHead.Rows[0]["HouseNo"].ToString(); txtVillage.Text = dtHead.Rows[0]["Village"].ToString(); txtMandal.Text = dtHead.Rows[0]["Mandal"].ToString(); txtDistrict.Text = dtHead.Rows[0]["District"].ToString(); txtState.Text = dtHead.Rows[0]["State"].ToString(); txtPin.Text = dtHead.Rows[0]["Pin"].ToString(); txtLandMark.Text = dtHead.Rows[0]["LandMark"].ToString(); cbCamps.Text = dtHead.Rows[0]["CampName"].ToString(); FillEmpDetails(dtEmpDetails); FillProdItemDetails(dtProdItemDetl); } else { flagUpdate = false; GenerateTransactionNo(); cbEcode.SelectedIndex = -1; txtEcodeSearch.Text = ""; dtpTrnDate.Value = DateTime.Today; txtHouseNo.Text = ""; txtLandMark.Text = ""; txtVillage.Text = ""; txtMandal.Text = ""; txtDistrict.Text = ""; txtState.Text = ""; txtPin.Text = ""; dtItemDetails.Rows.Clear(); dtAttEmpDetails.Rows.Clear(); gvAttendedEmpDetails.Rows.Clear(); gvItemDetails.Rows.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }