コード例 #1
0
        public ActionResult AdminDashboard_V_2()
        {
            DashboardModel objDashboardModel = new DashboardModel();
            objResponse    Response          = new objResponse();

            session = new SessionHelper();
            try
            {
                Response = objHomeManager.GetAdminDashboardData(Convert.ToInt64(session.UserSession.PIN));
                if (Response.ErrorCode == 0)
                {
                    objDashboardModel.TotalLeads        = Response.ResponseData.Tables[0].Rows[0][0].ToString();
                    objDashboardModel.TotalDeals        = Response.ResponseData.Tables[1].Rows[0][0].ToString();
                    objDashboardModel.TotalClients      = Response.ResponseData.Tables[2].Rows[0][0].ToString();
                    objDashboardModel.TotalDealsRevenue = Response.ResponseData.Tables[3].Rows[0][0].ToString();

                    objDashboardModel.LeadsTradition         = Response.ResponseData.Tables[4].Rows[0][0].ToString();
                    objDashboardModel.DealsTraditions        = Response.ResponseData.Tables[5].Rows[0][0].ToString();
                    objDashboardModel.ClientsTraditions      = Response.ResponseData.Tables[6].Rows[0][0].ToString();
                    objDashboardModel.DealsRevenueTraditions = Response.ResponseData.Tables[7].Rows[0][0].ToString();

                    objDashboardModel.LeadsPercentageChange        = Response.ResponseData.Tables[8].Rows[0][0].ToString();
                    objDashboardModel.DealsPercentageChange        = Response.ResponseData.Tables[9].Rows[0][0].ToString();
                    objDashboardModel.ClientsPercentageChange      = Response.ResponseData.Tables[10].Rows[0][0].ToString();
                    objDashboardModel.DealsRevenuePercentageChange = Response.ResponseData.Tables[11].Rows[0][0].ToString();

                    objDashboardModel.TaskCompletedPercentageToday     = Response.ResponseData.Tables[12].Rows[0][0].ToString();
                    objDashboardModel.TaskCompletedPercentageYesterday = Response.ResponseData.Tables[13].Rows[0][0].ToString();

                    if (Response.ResponseData.Tables[14].Rows.Count > 0)
                    {
                        foreach (DataRow dr in Response.ResponseData.Tables[14].Rows)
                        {
                            Opportunities objOpp = new Opportunities();
                            objOpp.Source                 = dr["Source"].ToString();
                            objOpp.RelateTo_Name          = dr["RealtedTo"].ToString();
                            objOpp.Amount                 = dr["Amount"].ToString();
                            objOpp.Stage                  = dr["Stage"].ToString();
                            objOpp.Opportunity_Owner_Name = dr["Op_owner"].ToString();
                            objOpp.AssignTO_Name          = dr["AssignToName"].ToString();

                            objDashboardModel.TopFiveDeals.Add(objOpp);
                        }
                    }

                    if (Response.ResponseData.Tables[15].Rows.Count > 0)
                    {
                        foreach (DataRow dr in Response.ResponseData.Tables[15].Rows)
                        {
                            Source objSource = new Source();
                            objSource.Source_Name = dr["Source_Text"].ToString();
                            objSource.TotalLeads  = dr["TotalLeads"].ToString();

                            objDashboardModel.TopThreeSources.Add(objSource);
                        }
                    }

                    if (Response.ResponseData.Tables[16].Rows.Count > 0)
                    {
                        foreach (DataRow dr in Response.ResponseData.Tables[16].Rows)
                        {
                            Project.Entity.Clients objClient = new Project.Entity.Clients();
                            objClient.Client_ID_Auto_PK = Convert.ToInt64(dr["Client_ID_Auto_PK"]);
                            objClient.Name    = Convert.ToString(dr["Name"]);
                            objClient.Date    = Convert.ToDateTime(dr["Date"]);
                            objClient.Email   = Convert.ToString(dr["Email"]);
                            objClient.SkypeNo = Convert.ToString(dr["SkypeNo"]);
                            objClient.Status  = Convert.ToString(dr["Status"]);

                            objDashboardModel.Contacts.Add(objClient);
                        }
                    }
                    return(View(objDashboardModel));
                }
                else
                {
                    return(View(objDashboardModel));
                }
            }
            catch (Exception ex)
            {
                BAL.Common.LogManager.LogError("GetOpportunityLostByMonth Post Method", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace));
                return(View(objDashboardModel));
            }
        }