/// <summary>
        /// Creates a cExternalProjectHead object. It will be saved in permanent storage only
        /// on calling Save()
        /// </summary>
        /// <returns>cExternalProjectHead object</returns>
        public static cExternalProjectHead Create()
        {
            cExternalProjectHead oObj = new cExternalProjectHead();

            SecurityCheck((int)enExternalProjectHead_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>cExternalProjectHead object</returns>
        public static cExternalProjectHead CreateIfRequiredAndGet(string i_sName)
        {
            cExternalProjectHead oObj = cExternalProjectHead.Get_Name(i_sName);

            if (oObj == null)
            {
                oObj       = cExternalProjectHead.Create();
                oObj.sName = i_sName;
                oObj.Save();
            }
            return(oObj);
        }
 public JsonResult  AddExternalHead(Externalhead head)
 {
     try
     {
         cExternalProjectHead ExtHead = cExternalProjectHead.Create();
         ExtHead.sName               = head.Name;
         ExtHead.sEmailID            = head.Email;
         ExtHead.sContactNo          = head.Contact;
         ExtHead.objClient.iObjectID = Convert.ToInt32(head.SelectedExternalClient[0]);
         ExtHead.bIsActive           = true;
         ExtHead.Save();
         head.ExternalClientList = getIClientList();
         ViewBag.DataSaved       = "External head added successfully";
         return(Json("1"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// Finds and return cExternalProjectHead objects matching the specified criteria
        /// </summary>
        /// <param name="i_oFilter">Filter criteria (WHERE clause)</param>
        /// <returns>cExternalProjectHead objects</returns>
        public static List <cExternalProjectHead> Find(cFilter i_oFilter)
        {
            DataTable dt = Find_DataTable(i_oFilter, null);
            List <cExternalProjectHead> l = new List <cExternalProjectHead>();
            cExternalProjectHead        oObj;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                oObj                   = new cExternalProjectHead();
                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_sContactNo          = Convert.ToString(dt.Rows[i]["sContactNo"]);
                oObj.m_sEmailID            = Convert.ToString(dt.Rows[i]["sEmailID"]);
                oObj.m_objClient.iObjectID = Convert.ToInt32(dt.Rows[i]["objClient"].ToString());
                oObj.m_bIsActive           = Convert.ToBoolean(dt.Rows[i]["bIsActive"]);
                oObj.m_bInvalid            = false;
                l.Add(oObj);
            }
            return(l);
        }