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 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()); } } }