private void GetDistrictDetails(string mode) { DataTable resultData = new DataTable(); BusinessLayer.BusinessLogic business = new BusinessLayer.BusinessLogic(); try { ddlDistrict.Items.Clear(); if (mode.Equals("change")) { string query = "select * from master_district_details where State_ID=" + ddlState.SelectedItem.Value; resultData = business.GetQueryResult(query); } else { resultData = business.GetTableDetails(ConfigurationManager.AppSettings["District_Info"].ToString()); } ddlDistrict.DataSource = resultData; if (resultData.Rows.Count > 0) { ddlDistrict.DataTextField = "District_Name"; ddlDistrict.DataValueField = "Id"; ddlDistrict.DataBind(); } ddlDistrict.Items.Insert(0, new ListItem("--Select District--", "0")); } catch (Exception ex) { } }
private void LoadProductDropdown() { DataTable resultData = new DataTable(); BusinessLayer.BusinessLogic business = new BusinessLayer.BusinessLogic(); try { string query = "select concat(cr.Crop_Name,' - ',date_format(fp.created_on,'%d-%m-%y')) as PrdInfo,fp.Id as ProductID from dealer_requirement_details fp " + "inner join master_crop_details cr on fp.Crop_ID = cr.Id inner join master_unit_details ut on fp.Unit_ID = ut.Id " + "inner join master_status_details st on fp.Status_Id = st.Id where fp.IsActive = True and fp.Dealer_ID =" + Session["Id"].ToString(); resultData = business.GetQueryResult(query); if (resultData.Rows.Count > 0) { ddlMyProduct.DataSource = resultData; ddlMyProduct.DataTextField = "PrdInfo"; ddlMyProduct.DataValueField = "ProductID"; ddlMyProduct.DataBind(); LoadGrid(); } ddlMyProduct.Items.Insert(0, new ListItem("--Select Product--", "0")); } catch (Exception ex) { } }
private void LoadProductDetails(string productID) { DataTable resultData = new DataTable(); DataTable resultData_SoldQty = new DataTable(); BusinessLayer.BusinessLogic business = new BusinessLayer.BusinessLogic(); try { string query = "select cr.Crop_Name,date_format(fp.created_on,'%d-%m-%y') as Posted_On,fp.Id as ProductID,fp.Request_Qty as Quantity,ut.Unit_Name as UOM,st.Status_Name as Status from dealer_requirement_details fp " + "inner join master_crop_details cr on fp.Crop_ID = cr.Id inner join master_unit_details ut on fp.Unit_ID = ut.Id " + "inner join master_status_details st on fp.Status_ID = st.Id " + "where fp.IsActive = True and fp.Id=" + productID; resultData = business.GetQueryResult(query); if (resultData.Rows.Count > 0) { lblCrop.Text = resultData.Rows[0]["Crop_Name"].ToString(); lblDate.Text = resultData.Rows[0]["Posted_On"].ToString(); lblSellingQty.Text = resultData.Rows[0]["Quantity"].ToString(); lblUnit.Text = resultData.Rows[0]["UOM"].ToString(); lblStatus.Text = resultData.Rows[0]["Status"].ToString(); lblSoldQty.Text = "0"; } string querySoldQty = "SELECT Received_Qty FROM farmer_db.dealer_farmer_transaction where Dealer_Req_ID=" + productID + " and IsApproved=1"; resultData_SoldQty = business.GetQueryResult(querySoldQty); if (resultData_SoldQty.Rows.Count > 0) { object sumObject; sumObject = resultData_SoldQty.Compute("Sum(Received_Qty)", string.Empty); lblSoldQty.Text = sumObject.ToString(); LoadGrid(); } else { gridProduct.DataSource = null; gridProduct.DataBind(); } } catch (Exception ex) { } }