Ejemplo n.º 1
0
        public JsonResult AssignProject(ProjectViewModel objprojectviewmodel)
        {
            try
            {
                if (objprojectviewmodel.SelectedEmpList.Count() > 0)
                {
                    foreach (var item in objprojectviewmodel.SelectedEmpList)
                    {
                        cProjectAssigned objProjectAssign = cProjectAssigned.Create();
                        objProjectAssign.objProject.iObjectID  = Convert.ToInt32(objprojectviewmodel.SelectedProject[0]);
                        objProjectAssign.objEmpLogin.iObjectID = Convert.ToInt32(item.ToString());
                        objProjectAssign.sDescription          = objprojectviewmodel.ProjectDescription;
                        objProjectAssign.bIsActive             = true;
                        objProjectAssign.Save();
                    }
                }
                return(Json("1"));

                //ProjectViewModel objProjectView = new ProjectViewModel();
                //objProjectView.ProjectList = getProjectList();
                //objProjectView.EmpList = getEmployeeList();
                //return View(objProjectView);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Ensures that an object with the specified name exists, while creating other properties are set to their default values
        /// </summary>
        /// <param name="i_sName">Name</param>
        /// <returns>cProjectAssigned object</returns>
        public static cProjectAssigned CreateIfRequiredAndGet(string i_sName)
        {
            cProjectAssigned oObj = cProjectAssigned.Get_Name(i_sName);

            if (oObj == null)
            {
                oObj       = cProjectAssigned.Create();
                oObj.sName = i_sName;
                oObj.Save();
            }
            return(oObj);
        }