Example #1
0
        /// <summary>
        /// Create a new tbl_itsupport_arrangment object.
        /// </summary>
        /// <param name="id">Initial value of the id property.</param>
        /// <param name="ref_personID">Initial value of the ref_personID property.</param>
        public static tbl_itsupport_arrangment Createtbl_itsupport_arrangment(global::System.Int32 id, global::System.Int32 ref_personID)
        {
            tbl_itsupport_arrangment tbl_itsupport_arrangment = new tbl_itsupport_arrangment();

            tbl_itsupport_arrangment.id           = id;
            tbl_itsupport_arrangment.ref_personID = ref_personID;
            return(tbl_itsupport_arrangment);
        }
Example #2
0
        public static bool InsertItSupportArrangement(int userID, int shiftID, string sProject, int nMonth, out string errmsg)
        {
            bool bOk = false;

            using (FavLinkEntities context = new FavLinkEntities())
            {
                var items = from x in context.tbl_itsupport_arrangment
                            where x.ref_personID == userID &&
                            x.shift == shiftID &&
                            x.month == nMonth &&
                            0 == x.project.CompareTo(sProject)
                            select x;
                if (items.Any())
                {
                    errmsg = string.Format("The arrangement already exist!");
                    return(false);
                }

                //insert
                var entity = new tbl_itsupport_arrangment()
                {
                    ref_personID = userID,
                    shift        = shiftID,
                    project      = sProject,
                    month        = nMonth,
                };
                try
                {
                    context.tbl_itsupport_arrangment.AddObject(entity);
                    context.SaveChanges();
                    bOk    = true;
                    errmsg = string.Empty;
                }
                catch (Exception ex)
                {
                    errmsg = ex.Message;
                }
            }
            return(bOk);
        }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tbl_itsupport_arrangment EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotbl_itsupport_arrangment(tbl_itsupport_arrangment tbl_itsupport_arrangment)
 {
     base.AddObject("tbl_itsupport_arrangment", tbl_itsupport_arrangment);
 }