Ejemplo n.º 1
0
        public string Create([Bind(Exclude = "ProjectID")]  FinaceTool.Models.ProjectTemp projecttemp)
        {
            string msg;

            if (projecttemp.OpportunityName != 0 && projecttemp.SOWStatus != 0)
            {
                Project project = new Project();
                project.Createddate   = System.DateTime.Now;
                project.IsActive      = true;
                project.SowStatusID   = projecttemp.SOWStatus;
                project.OpportunityID = projecttemp.OpportunityName;
                project.Createdby     = Session["UserName"].ToString();
                project.Modifiedby    = Session["UserName"].ToString();
                project.ProjectName   = projecttemp.ProjectName;
                project.poavilable    = projecttemp.poavilable;
                project.pobalance     = projecttemp.pobalance;
                project.Note          = projecttemp.Note;
                project.ProjectCode   = projecttemp.ProjectCode;
                db.Projects.Add(project);
                db.SaveChanges();
                int i = db.Usp_Update_Opportunity_IsMapped(projecttemp.OpportunityName);
                // GetOpportunityNames();
                msg = "Saved Successfully";
            }
            else
            {
                msg = "Opportunity Name Should provide to create a Project";
            }

            return(msg);
        }
Ejemplo n.º 2
0
        public string Edit(FinaceTool.Models.ProjectTemp projecttemp)
        {
            var    result = db.Projects.SingleOrDefault(b => b.ProjectID == projecttemp.ProjectID);
            string msg;

            if (ModelState.IsValid && result != null)
            {
                result.Note          = projecttemp.Note;
                result.OpportunityID = projecttemp.OpportunityName;
                result.poavilable    = projecttemp.poavilable;
                result.pobalance     = projecttemp.pobalance;
                result.ProjectName   = projecttemp.ProjectName;
                result.SowStatusID   = projecttemp.SOWStatus;
                result.Createdby     = Session["UserName"].ToString();
                result.Createddate   = System.DateTime.Now;
                result.ModifiedDate  = System.DateTime.Now;
                result.Modifiedby    = Session["UserName"].ToString();
                db.SaveChanges();
            }
            msg = "Saved Successfully";
            return(msg);
        }