Beispiel #1
0
        //[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        //public List<RevenueEntities> MPL1Data(string Fromdate, string Fromtime, string Todate, string Totime)
        public string MPL1Data(string strGraph, string Fromdate, string Fromtime, string Todate, string Totime)
        {
            DataTable         table          = new DataTable();
            ApplicationResult objResult      = new ApplicationResult();
            TempratureTrendBL objTempTrendBL = new TempratureTrendBL();


            DateTime dtFromDateTime = DateTime.ParseExact(Fromdate + " " + Fromtime, "dd/MM/yyyy HH:mm:ss",
                                                          System.Globalization.CultureInfo.InvariantCulture);
            DateTime dtToDateTime = DateTime.ParseExact(Todate + " " + Totime, "dd/MM/yyyy HH:mm:ss",
                                                        System.Globalization.CultureInfo.InvariantCulture);

            //DateTime dtFromDateTime = Convert.ToDateTime("28/10/2018 12:10:20");
            //DateTime dtToDateTime = Convert.ToDateTime("30/10/2018 12:10:20");
            objResult = objTempTrendBL.GetALl_TemperatureTrendData(dtFromDateTime, dtToDateTime, strGraph);
            if (objResult != null)
            {
                if (objResult.ResutlDs.Tables.Count > 0)
                {
                    table = objResult.ResutlDs.Tables[0];
                }
            }
            string strJsonResult = JsonConvert.SerializeObject(table, Newtonsoft.Json.Formatting.Indented);
            //return JsonConvert.SerializeObject(objResult.ResutlDs.Tables[0]);
            string j = JsonConvert.SerializeObject(objResult.ResutlDs.Tables[0]);

            return(j);
        }
Beispiel #2
0
        public void BindReportData()
        {
            try
            {
                ApplicationResult objResult      = new ApplicationResult();
                DateTime          dtFromDateTime = DateTime.ParseExact(txtFromDate.Text + " " + txtFromTime.Text, "dd/MM/yyyy HH:mm:ss",
                                                                       CultureInfo.InvariantCulture);
                DateTime dtToDateTime = DateTime.ParseExact(txtToDate.Text + " " + txtToTime.Text, "dd/MM/yyyy HH:mm:ss",
                                                            CultureInfo.InvariantCulture);
                int intGraphId = Convert.ToInt32(ddlPasteuriser.SelectedValue.ToString());
                // objResult = new MilkReceptionBL().MilkReception_SelectAll(dtFromDateTime, dtToDateTime, Convert.ToInt32(ddlShiftNo.SelectedValue), Convert.ToInt32(ddlTankerID.SelectedValue), Convert.ToDouble(ddlReceptionLineNo.SelectedValue), Convert.ToDouble(ddlSILONo.SelectedValue));

                objResult = new TempratureTrendBL().GetALl_TemperatureTrendDataReport(dtFromDateTime, dtToDateTime, intGraphId);
                //ViewState["DataTableMilkStorage"] = objResult.ResutlDs.Tables[0];

                gvTrendData.DataSource = null;
                gvTrendData.DataBind();

                gvTrendData.DataSource = objResult.ResultDt;
                gvTrendData.DataBind();
                //gvTotalQty.DataSource = objResult.ResutlDs.Tables[1];
                //gvTotalQty.DataBind();

                if (gvTrendData.Rows.Count > 1)
                {
                    imgbtnPDF.Visible = imgbtnExcel.Visible = divNo.Visible = true;
                    divNo.Visible     = false;

                    if (Convert.ToInt32(ddlPasteuriser.SelectedValue.ToString()) == 1)
                    {
                        lblHeader1.Text = "MPL-1 Temperature Report";
                        lblHeader2.Text = "MPL-1 Temperature Report";
                    }
                    else if (Convert.ToInt32(ddlPasteuriser.SelectedValue.ToString()) == 2)
                    {
                        lblHeader1.Text = "MPL-2 Temperature Report";
                        lblHeader2.Text = "MPL-2 Temperature Report";
                    }
                    else if (Convert.ToInt32(ddlPasteuriser.SelectedValue.ToString()) == 3)
                    {
                        lblHeader1.Text = "CPL Temperature Report";
                        lblHeader2.Text = "CPL Temperature Report";
                    }
                    else if (Convert.ToInt32(ddlPasteuriser.SelectedValue.ToString()) == 4)
                    {
                        lblHeader1.Text = "Curd Temperature Report";
                        lblHeader2.Text = "Curd Temperature Report";
                    }
                    else if (Convert.ToInt32(ddlPasteuriser.SelectedValue.ToString()) == 5)
                    {
                        lblHeader1.Text = "BM Temperature Report";
                        lblHeader2.Text = "BM Temperature Report";
                    }
                    else if (Convert.ToInt32(ddlPasteuriser.SelectedValue.ToString()) == 6)
                    {
                        lblHeader1.Text = "MPLBM Temperature Report";
                        lblHeader2.Text = "MPLBM Temperature Report";
                    }
                }
                else
                {
                    imgbtnPDF.Visible      = imgbtnExcel.Visible = divNo.Visible = false;
                    divNo.Visible          = true;
                    gvTrendData.DataSource = null;
                    gvTrendData.DataBind();

                    // ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp",
                    //"<script>alert('No Record Found.');</script>");
                }
            }
            catch (Exception ex)
            {
                log.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp",
                                                   "<script>alert('Oops! There is some technical Problem. Contact to your Administrator.');</script>");
            }
        }