Пример #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the UserInfoSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserInfoSet(UserInfo userInfo)
 {
     base.AddObject("UserInfoSet", userInfo);
 }
        public static bool hasLightsOnFeature()
        {
            if (Membership.GetUser() == null)
                return false;

            Guid UserId = (Guid)Membership.GetUser().ProviderUserKey;

            using (DB db = new DB())
            {
                UserInfo info = (from o in db.UserInfoSet
                                 where o.UserId == UserId
                                 select o).FirstOrDefault();

                if (info == null)
                {
                    DateTime d = DateTime.Now;

                    info = new UserInfo();
                    info.UserId = UserId;
                    info.UseLights = false;
                    info.ShiftStart = new DateTime(d.Year, d.Month, d.Day, 6, 0, 0);
                    info.EffChartEnabled = false;
                    info.EstimatedOutput = 0;

                    db.AddToUserInfoSet(info);
                    db.SaveChanges();

                    return false;
                }
                else
                {
                    return info.UseLights;
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Create a new UserInfo object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="effChartEnabled">Initial value of the EffChartEnabled property.</param>
 /// <param name="estimatedOutput">Initial value of the EstimatedOutput property.</param>
 /// <param name="useLights">Initial value of the UseLights property.</param>
 /// <param name="hidePanel">Initial value of the HidePanel property.</param>
 /// <param name="hideHelper">Initial value of the HideHelper property.</param>
 public static UserInfo CreateUserInfo(global::System.Int32 id, global::System.Guid userId, global::System.Boolean effChartEnabled, global::System.Int32 estimatedOutput, global::System.Boolean useLights, global::System.Boolean hidePanel, global::System.Boolean hideHelper)
 {
     UserInfo userInfo = new UserInfo();
     userInfo.Id = id;
     userInfo.UserId = userId;
     userInfo.EffChartEnabled = effChartEnabled;
     userInfo.EstimatedOutput = estimatedOutput;
     userInfo.UseLights = useLights;
     userInfo.HidePanel = hidePanel;
     userInfo.HideHelper = hideHelper;
     return userInfo;
 }