public string AddProject(projectDetails projDetails, int?sno)
        {
            projectEstimatorEntities e = new projectEstimatorEntities();
            string message             = "Project Details are saved successfully..!";

            if (sno != null)
            {
                projectDetail p = new projectDetail();
                p                  = (from pd in e.projectDetails where pd.sno == sno select pd).SingleOrDefault();
                p.projectName      = projDetails.ProjectName;
                p.devActivityHours = JsonConvert.SerializeObject(projDetails);
                p.Employee         = "";
                e.SaveChanges();
                message = "Project Details are updated successfully..!";
            }
            else
            {
                projectDetail p = new projectDetail();
                p.projectName      = projDetails.ProjectName;
                p.devActivityHours = JsonConvert.SerializeObject(projDetails);
                p.Employee         = "";
                e.projectDetails.Add(p);
                e.SaveChanges();
            }

            return(message); // View(message, JsonRequestBehavior.AllowGet);
        }
Example #2
0
        public JsonResult AddNewUser(user ud)
        {
            string message = "";

            try
            {
                projectEstimatorEntities pe = new projectEstimatorEntities();
                user u         = new user();
                int  checkUser = (from us in pe.users where us.userName == ud.userName select us).Count();
                if (checkUser == 0)
                {
                    u.userName = ud.userName;
                    u.password = ud.password;
                    pe.users.Add(u);
                    pe.SaveChanges();
                    message = "User Added Successfully..!";
                }
                else
                {
                    message = "User Already Exist..!";
                }
            }
            catch (Exception ex)
            {
                message = ex.Message.ToString();
            }
            return(Json(message, JsonRequestBehavior.AllowGet));
        }
        public ActionResult EditProject(int sno)
        {
            projectDetail            pd = new projectDetail();
            projectEstimatorEntities pe = new projectEstimatorEntities();

            pd = (from p in pe.projectDetails where p.sno == sno select p).FirstOrDefault();
            return(Json(pd, JsonRequestBehavior.AllowGet));
        }
        public ActionResult LoadProject()
        {
            projectEstimatorEntities e  = new projectEstimatorEntities();
            List <projectDetail>     p  = new List <projectDetail>();
            List <projectDashboard>  pd = new List <projectDashboard>();

            p = (from proj in e.projectDetails select proj).ToList();
            return(Json(p, JsonRequestBehavior.AllowGet));
        }
        public ActionResult DeleteProject(int projectID)
        {
            projectDetail            p  = new projectDetail();
            projectEstimatorEntities pe = new projectEstimatorEntities();

            p = (from pp in pe.projectDetails where pp.sno.Equals(projectID) select pp).FirstOrDefault();
            pe.projectDetails.Remove(p);
            pe.SaveChanges();
            return(Json("Project Deleted Successfully..!", JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public JsonResult Login(user ud)
        {
            string message = "";

            try
            {
                projectEstimatorEntities pe = new projectEstimatorEntities();
                user u      = new user();
                int  isUser = (from us in pe.users where us.userName == ud.userName && us.password == ud.password select us).Count();
                if (isUser > 0)
                {
                    message = "Loggin Successfully..!";
                }
                else
                {
                    message = "Please Check your credentials";
                }
            }
            catch (Exception ex)
            {
                message = ex.Message.ToString();
            }
            return(Json(message, JsonRequestBehavior.AllowGet));
        }
        public ActionResult EstimateProject(projectEstimation pe)
        {
            projectEstimatorEntities e = new projectEstimatorEntities();
            List <projectDetail>     p = new List <projectDetail>();
            Constants c = new Constants();

            p = (from proj in e.projectDetails select proj).ToList();

            List <estimateHours> ee     = new List <estimateHours>();
            List <string>        legend = new List <string>();
            double productity           = pe.developers * c.ProductivityHours;

            double sqlAvg            = getAverage(p, c.SQLCount, c.sqlHours);
            double uiAvg             = getAverage(p, c.UICount, c.UIHours);
            double backendAvg        = getAverage(p, c.UICount, c.ControllerHours);
            double unitTestAvg       = getAverage(p, c.UICount, c.UnitTestHours);
            double techinicalTestAvg = getAverage(p, c.UICount, c.TechnicalTestHours);
            double bugFixAvg         = getAverage(p, c.BugCounts, c.BugHours);

            //SQL Chart
            estimateHours esql = new estimateHours();

            esql.name  = c.SQLHOURS.ToString();
            esql.value = pe.sqlTable * int.Parse(sqlAvg.ToString());
            sqlHours   = esql.value;
            ee.Add(esql);
            legend.Add(c.SQLHOURS.ToString());

            // UI Chart
            estimateHours eUI = new estimateHours();

            eUI.name  = c.UIHOURS.ToString();
            eUI.value = pe.uiScreens * int.Parse(uiAvg.ToString());
            UIHours   = eUI.value;
            ee.Add(eUI);
            legend.Add(c.UIHOURS.ToString());

            if (pe.backendCode)
            {
                estimateHours eback = new estimateHours();
                eback.name   = c.BackendHOURS.ToString();
                eback.value  = backendAvg * pe.uiScreens;
                BackendHours = eback.value;
                ee.Add(eback);
                legend.Add(c.BackendHOURS.ToString());
            }
            if (pe.unitTesting)
            {
                estimateHours eUnit = new estimateHours();
                eUnit.name    = c.UnittestingHOURS.ToString();
                eUnit.value   = unitTestAvg * pe.uiScreens;
                UnitTestHours = eUnit.value;
                ee.Add(eUnit);
                legend.Add(c.UnittestingHOURS.ToString());
            }
            if (pe.technicalTesting)
            {
                estimateHours etech = new estimateHours();
                etech.name    = c.TechnicaltestingHOURS.ToString();
                etech.value   = techinicalTestAvg * pe.uiScreens;
                TechTestHours = etech.value;
                ee.Add(etech);
                legend.Add(c.TechnicaltestingHOURS.ToString());
            }
            if (pe.bugFixing)
            {
                estimateHours ebug = new estimateHours();
                ebug.name      = c.BugfixingHOURS.ToString();
                ebug.value     = bugFixAvg * pe.uiScreens;
                BugFixingHours = ebug.value;
                ee.Add(ebug);
                legend.Add(c.BugfixingHOURS.ToString());
            }
            List <double> lstAvg = new List <double>();

            lstAvg.Add(productity);
            lstAvg.Add(pe.sqlTable * sqlAvg);
            lstAvg.Add(pe.uiScreens * uiAvg);
            lstAvg.Add(backendAvg * pe.uiScreens);
            lstAvg.Add(unitTestAvg * pe.uiScreens);
            lstAvg.Add(techinicalTestAvg * pe.uiScreens);
            lstAvg.Add(bugFixAvg * pe.uiScreens);
            lst.Add(ee);
            lst.Add(lstAvg);

            return(Json(lst, JsonRequestBehavior.AllowGet));
        }