private void LoadDistrict() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); DataTable DT = objDistrict.GetAll(0); ddlDistrict.DataSource = DT; ddlDistrict.DataBind(); ddlDistrict.Items.Insert(0, new ListItem("All District", "0")); }
private void LoadDistrict() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); DataTable dt = objDistrict.GetAll(Convert.ToInt32(ddlState.SelectedValue)); ddlDistrict.DataSource = dt; ddlDistrict.DataBind(); ddlDistrict.Items.Insert(0, new ListItem("--Select District--", "0")); }
protected void PopulateDropDownLists() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); DataTable DT = objDistrict.GetAll(0); ddlDistrict.DataSource = DT; ddlDistrict.DataBind(); ddlDistrict.Items.Insert(0, new ListItem("All District", "0")); }
protected void LoadDistrict() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); int stateid = (ddlState.SelectedIndex == 0) ? 0 : int.Parse(ddlState.SelectedValue); DataTable dt = objDistrict.GetAll(stateid); if (dt != null) { dgvDistrict.DataSource = dt; dgvDistrict.DataBind(); } }
protected void LoadDistrict() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); int stateid = 0; DataView dtDistrict = new DataView(objDistrict.GetAll(stateid)); dtDistrict.RowFilter = "DistrictId NOT IN (3,5,9,10,13,15,18,27,28,33)"; if (dtDistrict != null) { ddlDistrict.DataSource = dtDistrict; ddlDistrict.DataBind(); InsertFisrtItem(ddlDistrict, "--SELECT--"); } }
protected void PopulateDistricts() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); DataTable dtDistrict = new DataTable(); int stateid = 0; dtDistrict = objDistrict.GetAll(stateid); if (dtDistrict != null) { ddlDistrict.DataSource = dtDistrict; ddlDistrict.DataTextField = "DistrictName"; ddlDistrict.DataValueField = "DistrictId"; ddlDistrict.DataBind(); } }
protected void LoadDistricts() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); DataTable dtDistrict = new DataTable(); int stateid = (ddlState.SelectedIndex == 0) ? 0 : int.Parse(ddlState.SelectedValue); dtDistrict = objDistrict.GetAll(stateid); if (dtDistrict != null) { ddlDistrict.DataSource = dtDistrict; ddlDistrict.DataTextField = "DistrictName"; ddlDistrict.DataValueField = "DistrictId"; ddlDistrict.DataBind(); } InsertFisrtItem(ddlDistrict, "Select"); }
protected void LoadDistrict() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); DataTable dtDistrict = new DataTable(); int stateid = 0; dtDistrict = objDistrict.GetAll(stateid); if (dtDistrict != null) { ddlDistrict.DataSource = dtDistrict; ddlDistrict.DataTextField = "DistrictName"; ddlDistrict.DataValueField = "DistrictId"; ddlDistrict.DataBind(); } InsertFisrtItem(ddlDistrict, "--Select District--"); }
protected void PopulateDistrict() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); district = objDistrict.GetDistrictById(DistrictId); if (district != null) { DistrictId = district.DistrictId; txtDistrictName.Text = district.DistrictName.ToString(); ddlState.SelectedValue = district.StateId.ToString(); txtCode.Text = district.Code.ToString(); if (txtRemarks.Text == string.Empty) { district.Remarks = string.Empty; } else { txtRemarks.Text = district.Remarks.ToString(); } Message.Show = false; btnSave.Text = "Update"; } }
protected void btnSave_Click(object sender, EventArgs e) { try { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); district.DistrictId = DistrictId; district.DistrictName = txtDistrictName.Text.Trim(); district.StateId = Convert.ToInt32(ddlState.SelectedValue); district.Code = txtCode.Text.Trim(); district.Remarks = txtRemarks.Text.Trim(); objDistrict.Save(district); Clear(); LoadDistrict(); Message.IsSuccess = true; Message.Text = "District Saved Successfully."; } catch { Message.IsSuccess = false; Message.Text = "Can Not Save. Duplicate District Name Is Not Allowed!!!"; } Message.Show = true; }
protected void LoadMonthlyPrice() { int Month = int.Parse(ddlMonth.SelectedValue.Trim()); int Year = int.Parse(ddlYear.SelectedValue.Trim()); int DaysCount = DateTime.DaysInMonth(Year, Month); BusinessLayer.Common.District Objdistrict = new BusinessLayer.Common.District(); DataTable dt = Objdistrict.SMSDistrictGetAll(); int RowCount = dt.Rows.Count; DataTable dtMonthly = new DataTable(); dtMonthly.Columns.Add("DistName", typeof(string)); for (int k = 1; k <= 31; k++) { dtMonthly.Columns.Add(k.ToString(), typeof(string)); } dtMonthly.Columns.Add("Month", typeof(int)); dtMonthly.Columns.Add("Avg", typeof(string)); dtMonthly.Columns.Add("NeccPrice", typeof(string)); foreach (DataRow drDist in dt.Rows) { string str; int DistrictId = Convert.ToInt32(drDist["DistrictId"].ToString()); BusinessLayer.Common.BirdPrice ObjBirdPrice = new BusinessLayer.Common.BirdPrice(); DataTable dt1 = ObjBirdPrice.GetAllMonthly(Month, Year, DistrictId); DateTime TodayDate = DateTime.Now; int monthNo = TodayDate.Month; //Remove today rate if (monthNo == Month) { int Maxrow = dt1.Rows.Count - 1; dt1.Rows.RemoveAt(Maxrow); dt1.AcceptChanges(); } //DateTime LocalDate = DateTime.Now.AddHours(10); //if (dt1 != null && dt1.Rows.Count > 0) //{ // dt1 = dt1.AsEnumerable().Where(r => // !( // Convert.ToDateTime(r["date"]).Day == LocalDate.Day // && Convert.ToDateTime(r["date"]).Month == LocalDate.Month // && Convert.ToDateTime(r["date"]).Year == LocalDate.Month)).CopyToDataTable(); //} //if (dt1 != null && dt1.Rows.Count > 0) //{ // dt1 = dt1.AsEnumerable().Where(r => // !( // Convert.ToDateTime(r["date"]).Day == DateTime.Now.Day // && Convert.ToDateTime(r["date"]).Month == DateTime.Now.Month // && Convert.ToDateTime(r["date"]).Year == DateTime.Now.Year)).CopyToDataTable(); //} Count1++; DataRow dr = dtMonthly.NewRow(); if (dt1.Rows.Count != 0 && dt != null) { int TotalFramRate = 0, TotalRetailerRate = 0, TotalDressedRate = 0, TotalBroilerRate = 0; double AvgFramRate, AvgRetailerRate, AvgDressedRate, AvgBroilerRate; int Count = 0; int j = 0, K = 0; dr["DistName"] = str = (dt1.Rows[Count]["DistrictName"].ToString().Length == 0) ? "--" : dt1.Rows[Count]["DistrictName"].ToString(); foreach (DataRow dr1 in dt1.Rows) { DateTime Date = Convert.ToDateTime(dr1["Date"].ToString()); int Day = int.Parse(Date.Day.ToString()); while (Day > Count) { if (Day == Count + 1) { dr[Count + 1] = (dt1.Rows[j]["FarmRate"].ToString() + "/" + dt1.Rows[j]["RetailerRate"].ToString() + "/" + dt1.Rows[j]["BroilerRate"].ToString() + "/" + dt1.Rows[j]["DressedRate"].ToString()); TotalFramRate = TotalFramRate + Convert.ToInt32(dt1.Rows[j]["FarmRate"].ToString()); TotalRetailerRate = TotalRetailerRate + Convert.ToInt32(dt1.Rows[j]["RetailerRate"].ToString()); TotalDressedRate = TotalDressedRate + Convert.ToInt32(dt1.Rows[j]["DressedRate"].ToString()); TotalBroilerRate = TotalBroilerRate + Convert.ToInt32(dt1.Rows[j]["BroilerRate"].ToString()); Count++; j++; K = K + 1; } else { for (int i = Count + 1; i < Day; i++) { dr[Count + 1] = "--" + "\n" + "--"; Count++; } } } } AvgFramRate = TotalFramRate / K; AvgRetailerRate = TotalRetailerRate / K; AvgDressedRate = TotalDressedRate / K; AvgBroilerRate = TotalBroilerRate / K; dr["Avg"] = AvgFramRate.ToString() + "/" + AvgRetailerRate.ToString() + "/" + AvgBroilerRate.ToString() + "/" + AvgDressedRate.ToString(); while (Count < 31) { dr[Count + 1] = "--" + "\n" + "--"; Count++; } dr["Month"] = Month; dtMonthly.Rows.Add(dr); dtMonthly.AcceptChanges(); } } if (dtMonthly.Rows.Count != 0) { dgvMonthlyPrice.Visible = true; DataRow dr2 = dtMonthly.NewRow(); BusinessLayer.Common.EggPrice ObjEggprice = new BusinessLayer.Common.EggPrice(); DataTable dt2 = ObjEggprice.GetEggPrice(Month, Year); DateTime TodayDate = DateTime.Now; int monthNo = TodayDate.Month; //Remove today bird price if (monthNo == Month) { int Maxrow = dt2.Rows.Count - 1; dt2.Rows.RemoveAt(Maxrow); dt2.AcceptChanges(); } //DateTime LocalDate = DateTime.Now.AddHours(10); //if (dt2 != null && dt2.Rows.Count > 0) //{ // dt2 = dt2.AsEnumerable().Where(r => // !( // Convert.ToDateTime(r["date"]).Day == LocalDate.Day // && Convert.ToDateTime(r["date"]).Month == LocalDate.Month // && Convert.ToDateTime(r["date"]).Year == LocalDate.Month)).CopyToDataTable(); //} //if (dt2 != null && dt2.Rows.Count > 0) //{ // dt2 = dt2.AsEnumerable().Where(r => // !( // Convert.ToDateTime(r["date"]).Day == DateTime.Now.Day // && Convert.ToDateTime(r["date"]).Month == DateTime.Now.Month // && Convert.ToDateTime(r["date"]).Year == DateTime.Now.Year)).CopyToDataTable(); //} dr2["DistName"] = "NECC Egg Rate"; int j = 1; foreach (DataRow DrNecc in dt2.Rows) { dr2[j] = DrNecc["NECCPrice"].ToString().Length == 0 ? "--" : DrNecc["NECCPrice"].ToString(); j++; } Decimal AvgNECCPrice = Convert.ToDecimal(dt2.Compute("AVG([NECCPrice])", "")); dr2["Avg"] = AvgNECCPrice.ToString("0.00"); dtMonthly.Rows.Add(dr2); ViewState["RowCount"] = dtMonthly.Rows.Count; dgvMonthlyPrice.DataSource = dtMonthly; dgvMonthlyPrice.DataBind(); } else { dgvMonthlyPrice.Visible = false; } }
protected void PopulateDropDownLists() { BusinessLayer.Common.District objDistrict = new BusinessLayer.Common.District(); DataTable DT = objDistrict.GetAll(0); }