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; } }
/// <summary> /// Creates a cProjectAssigned object. It will be saved in permanent storage only /// on calling Save() /// </summary> /// <returns>cProjectAssigned object</returns> public static cProjectAssigned Create() { cProjectAssigned oObj = new cProjectAssigned(); SecurityCheck((int)enProjectAssigned_Action.Create); // Create an object in memory, will be saved to storage on calling Save() oObj.m_bCreating = true; oObj.m_bInvalid = false; return(oObj); }
/// <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); }
/// <summary> /// Finds and return cProjectAssigned objects matching the specified criteria /// </summary> /// <param name="i_oFilter">Filter criteria (WHERE clause)</param> /// <returns>cProjectAssigned objects</returns> public static List <cProjectAssigned> Find(cFilter i_oFilter) { DataTable dt = Find_DataTable(i_oFilter, null); List <cProjectAssigned> l = new List <cProjectAssigned>(); cProjectAssigned oObj; for (int i = 0; i < dt.Rows.Count; i++) { oObj = new cProjectAssigned(); oObj.m_iID = Convert.ToInt32(dt.Rows[i]["iID"]); oObj.m_sName = dt.Rows[i]["sName"].ToString(); oObj.m_dtCreatedOn = Convert.ToDateTime(dt.Rows[i]["dtCreatedOn"]); oObj.m_dtLastUpdatedOn = Convert.ToDateTime(dt.Rows[i]["dtLastUpdatedOn"]); oObj.m_sDescription = Convert.ToString(dt.Rows[i]["sDescription"]); oObj.m_objProject.iObjectID = Convert.ToInt32(dt.Rows[i]["objProject"].ToString()); oObj.m_objEmpLogin.iObjectID = Convert.ToInt32(dt.Rows[i]["objEmpLogin"].ToString()); oObj.m_bIsActive = Convert.ToBoolean(dt.Rows[i]["bIsActive"]); oObj.m_bInvalid = false; l.Add(oObj); } return(l); }
using System;