Example #1
0
        protected void Save()
        {
            BusinessLayer.PotatoLoadingUnloading ObjRate = new BusinessLayer.PotatoLoadingUnloading();

            DataTable dt = new DataTable();

            dt.Columns.Add("DistrictId");
            dt.Columns.Add("Capacity");
            dt.Columns.Add("Loading");
            dt.Columns.Add("Year");

            DataRow dr;

            foreach (GridViewRow row in dgvDistrict.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    string DistrictId = dgvDistrict.DataKeys[row.RowIndex].Value.ToString();
                    string Capacity   = FitRate(((TextBox)row.FindControl("txtCapacity")).Text.Trim());
                    string Loading    = FitRate(((TextBox)row.FindControl("txtLoading")).Text.Trim());


                    dr = dt.NewRow();
                    dr["DistrictId"] = DistrictId;
                    dr["Capacity"]   = Capacity;
                    dr["Loading"]    = Loading;
                    dr["Year"]       = ddlYear.SelectedValue;

                    dt.Rows.Add(dr);
                    dt.AcceptChanges();
                }
            }

            ObjRate.Save(dt);
        }
Example #2
0
        protected void Save()
        {
            BusinessLayer.PotatoLoadingUnloading ObjRate = new BusinessLayer.PotatoLoadingUnloading();

            DataTable dt = new DataTable();

            dt.Columns.Add("DistrictId");
            dt.Columns.Add("Unloading");
            dt.Columns.Add("Month");
            dt.Columns.Add("Year");
            DataRow dr;

            foreach (GridViewRow row in dgvDistrict.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    string DistrictId = dgvDistrict.DataKeys[row.RowIndex].Value.ToString();
                    string UnLoading  = FitRate(((TextBox)row.FindControl("txtUnloading")).Text.Trim());


                    dr = dt.NewRow();
                    dr["DistrictId"] = DistrictId;
                    dr["Month"]      = ddlMonth.SelectedValue;
                    dr["Unloading"]  = UnLoading;
                    dr["Year"]       = ddlYear.SelectedValue;
                    dt.Rows.Add(dr);
                    dt.AcceptChanges();
                }
            }

            ObjRate.SaveUnloading(dt);
            lbl1.Text = "Unloding Entry saved/Updated successfully";
        }
Example #3
0
        protected void LodUnloading()
        {
            BusinessLayer.PotatoLoadingUnloading ObjRate = new BusinessLayer.PotatoLoadingUnloading();
            String    Year = ddlYear.SelectedValue;
            DataTable dt   = ObjRate.GetCapacityAndLoadingByYear(Year);

            if (dt != null)
            {
                dgvDistrict.DataSource = dt;
                dgvDistrict.DataBind();
            }
            lbl2.Text = "";
        }
Example #4
0
        protected void LodUnloading()
        {
            BusinessLayer.PotatoLoadingUnloading ObjRate = new BusinessLayer.PotatoLoadingUnloading();
            String    Year  = ddlYear.SelectedValue;
            int       Month = Convert.ToInt32(ddlMonth.SelectedValue);
            DataTable dt    = ObjRate.GetUnloadingByMonthAndYear(Month, Year);

            if (dt != null)
            {
                dgvDistrict.DataSource = dt;
                dgvDistrict.DataBind();
            }
            lbl1.Text = "";
        }
Example #5
0
        protected void LoadMsg()
        {
            BusinessLayer.PotatoLoadingUnloading ObjRate = new BusinessLayer.PotatoLoadingUnloading();
            int    Month     = Convert.ToInt32(ddlMonth.SelectedValue);
            String MonthName = "";

            if (Month == 1)
            {
                MonthName = "Jan";
            }
            if (Month == 2)
            {
                MonthName = "Feb";
            }
            if (Month == 3)
            {
                MonthName = "Mar";
            }
            if (Month == 4)
            {
                MonthName = "Apr";
            }
            if (Month == 5)
            {
                MonthName = "May";
            }
            if (Month == 6)
            {
                MonthName = "Jun";
            }
            if (Month == 7)
            {
                MonthName = "Jul";
            }
            if (Month == 8)
            {
                MonthName = "Aug";
            }
            if (Month == 9)
            {
                MonthName = "Sep";
            }
            if (Month == 10)
            {
                MonthName = "Oct";
            }
            if (Month == 11)
            {
                MonthName = "Nov";
            }
            if (Month == 12)
            {
                MonthName = "Dec";
            }
            string    Year = ddlYear.SelectedValue;
            DataTable dt   = ObjRate.GetUnloadingByMonthAndYear(Month, Year);

            string month = ddlMonth.SelectedValue.Trim();

            month = (month.Length == 1) ? "0" + month : month;

            string year = ddlYear.SelectedValue.Trim();
            //year = year.Substring(2);

            StringBuilder sb = new StringBuilder();

            sb.Append("Approx Loading-Unloading Report Upto ");
            sb.Append(MonthName + "-" + year + "\nDist:Loading/Unloading/Percentage\n");
            decimal TotalLoading   = 0;
            decimal TotalUnLoading = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sb.Append(dt.Rows[i][1].ToString().Trim() + ":");
                sb.Append(FitRate(dt.Rows[i][3].ToString().Trim()) + "/");
                sb.Append(FitRate(dt.Rows[i][2].ToString().Trim()) + "/");
                sb.Append(FitRate(dt.Rows[i][4].ToString().Trim()) + "%");
                TotalLoading   = TotalLoading + Convert.ToDecimal(FitRate(dt.Rows[i][3].ToString().Trim()));
                TotalUnLoading = TotalUnLoading + Convert.ToDecimal(FitRate(dt.Rows[i][2].ToString().Trim()));
                if (i != dt.Rows.Count - 1)
                {
                    sb.Append("\n");
                }
            }
            sb.Append("\nTotal :" + TotalLoading + "/" + TotalUnLoading + "/" + Convert.ToDecimal(FitRate(((TotalUnLoading / TotalLoading) * 100).ToString())) + "%");
            sb.Append("\n95631 53631 (10am - 6pm)");
            txtMsg.Text        = sb.ToString();
            txtMsgPreview.Text = txtMsg.Text;
        }