Exemplo n.º 1
0
        public void Remove(int Id)
        {
            WhatsNew w = data.WhatsNews.Find(Id);

            data.WhatsNews.Remove(w);
            data.SaveChanges();
        }
Exemplo n.º 2
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            Title = (!String.IsNullOrEmpty(Title) ? Title : Resources.Resource.RecentActivity);

            var activityBox = (RecentActivityBox)TemplateControl.LoadControl(RecentActivityBox.Location);

            activityBox.userActivityList = UserActivityManager.GetUserActivities(
                TenantId,
                UserId,
                ProductId,
                new[] { ModuleId },
                UserActivityConstants.AllActionType,
                null,
                0, MaxItems);
            activityBox.MaxLengthTitle = 20;
            activityBox.ItemCSSClass   = ItemCSSClass;
            Controls.Add(activityBox);

            Controls.Add(new LiteralControl
            {
                Text =
                    string.Format("<div style='margin:10px 20px 0 20px;'><a href='{0}'>{1}</a></div>",
                                  WhatsNew.GetUrlForModule(ProductId, ModuleId),
                                  Resources.Resource.ToWhatsNewPage)
            });
        }
Exemplo n.º 3
0
      public ActionResult DeleteConfirmed(int id)
      {
          WhatsNew whatsNew = db.WhatsNews.Find(id);

          db.WhatsNews.Remove(whatsNew);
          db.SaveChanges();
          return(RedirectToAction("Index"));
      }
        /// <summary>
        /// Shows the dialog to the user.
        /// </summary>
        public Dialog Show(bool showVersion = false)
        {
            var view = LayoutInflater.From(context).Inflate(Resource.Layout.dialog_whats_new, null, false);

            var content  = view.FindViewById <TextView>(Resource.Id.content);
            var checkbox = view.FindViewById <CheckBox>(Resource.Id.checkbox);

            checkbox.CheckedChange += (sender, e) => {
                prefs.showWhatsNew = e.IsChecked;
            };

            var adb = new IONAlertDialog(context);

            adb.SetTitle(string.Format(context.GetString(Resource.String.whats_new_in), currentVersion));
            adb.SetView(view);

            adb.SetNegativeButton(Resource.String.ok_done, (obj, e) => {
                var dialog = obj as Dialog;
                dialog.Dismiss();
            });

            var ret = adb.Show();

            Task.Factory.StartNew(() => {
                var sb = new StringBuilder();

                var news = new List <WhatsNew>();
                news.AddRange(WhatsNew.ParseWithException(context.Resources.GetXml(Resource.Xml.whats_new)));
                news.AddRange(WhatsNew.ParseWithException(context.Resources.GetXml(Resource.Xml.whats_new_history)));

                // Trim the unnecessary versions.
                for (int i = news.Count - 1; i >= 0; i--)
                {
                    if (news[i].versionCode.CompareTo(oldVersion) < 0 || news[i].versionCode.CompareTo(currentVersion) > 0)
                    {
                        news.RemoveAt(i);
                    }
                }

                if (showVersion)
                {
                    PrintIndividualUpdates(news, sb);
                }
                else
                {
                    PrintCollapsedUpdates(news, sb);
                }


                handler.Post(() => {
                    Appion.Commons.Util.Log.D(this, "Posting: " + sb.ToString());
                    content.TextFormatted = Html.FromHtml(sb.ToString());
                });
            });

            return(ret);
        }
Exemplo n.º 5
0
        public JsonResult Index()
        {
            List <WhatsNewCustomerMap> sawWhatsNew = this.whatsNewCustomerMapRepository
                                                     .GetAll()
                                                     .Where(x => x.Customer == this.context.Customer && x.Understood)
                                                     .ToList();

            List <int> excludedWhatsNews = ObjectFactory.GetInstance <IWhatsNewExcludeCustomerOriginRepository>()
                                           .GetAll()
                                           .Where(x => x.CustomerOriginID == this.context.Customer.CustomerOrigin.CustomerOriginID)
                                           .Select(x => x.WhatsNewId)
                                           .ToList();

            if (sawWhatsNew.Any())
            {
                List <int> sawWhatsNewIdList = sawWhatsNew.Select(w => w.WhatsNew.Id).ToList();

                WhatsNew whatsNew = this.whatsNewRepository
                                    .GetAll()
                                    .FirstOrDefault(x =>
                                                    !excludedWhatsNews.Contains(x.Id) &&
                                                    !sawWhatsNewIdList.Contains(x.Id) &&
                                                    x.Active &&
                                                    x.ValidUntil.Date >= DateTime.Today
                                                    );

                if (whatsNew != null)
                {
                    return(Json(new {
                        success = true,
                        whatsNew = whatsNew.WhatsNewHtml,
                        whatsNewId = whatsNew.Id,
                    }, JsonRequestBehavior.AllowGet));
                }                 // if
            }
            else
            {
                var whatsNew = this.whatsNewRepository
                               .GetAll()
                               .FirstOrDefault(x =>
                                               !excludedWhatsNews.Contains(x.Id) &&
                                               x.Active &&
                                               x.ValidUntil.Date >= DateTime.Today
                                               );

                if (whatsNew != null)
                {
                    return(Json(new {
                        success = true,
                        whatsNew = whatsNew.WhatsNewHtml,
                        whatsNewId = whatsNew.Id,
                    }, JsonRequestBehavior.AllowGet));
                }         // if
            }             // if

            return(Json(new { success = true, noWhatsNew = true }, JsonRequestBehavior.AllowGet));
        }         // Index
Exemplo n.º 6
0
        public ActionResult Edit([Bind(Include = "Id,CurrentDate,heading,description")] WhatsNew whatsNew)
        {
            if (ModelState.IsValid)
            {
                db.Edit(whatsNew);

                return(RedirectToAction("Index"));
            }
            return(View(whatsNew));
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            oWhatsNew  = new WhatsNew(intProfile, dsn);
            oFunction  = new Functions(intProfile, dsn, intEnvironment);
            if (Request.Path == "/index.aspx")
            {
                Response.Redirect("/interior.aspx");
            }

            BindControls();
            lblNew.Visible = (rptNew.Items.Count == 0);
        }
Exemplo n.º 8
0
      public ActionResult Edit([Bind(Include = "ID,HeaderText,Date,DisplayDate,ImageID,BodyText,Display")] WhatsNew whatsNew)
      {
          if (ModelState.IsValid)
          {
              whatsNew.Date = DateTime.Now;

              db.Entry(whatsNew).State = EntityState.Modified;
              db.SaveChanges();
              return(RedirectToAction("Index"));
          }
          ViewBag.ImageID = new SelectList(db.Images, "ImageID", "ImageName", whatsNew.ImageID);
          return(View(whatsNew));
      }
Exemplo n.º 9
0
        // GET: WhatsNews/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WhatsNew whatsNew = db.FindById(Convert.ToInt32(id));

            if (whatsNew == null)
            {
                return(HttpNotFound());
            }
            return(View(whatsNew));
        }
Exemplo n.º 10
0
      // GET: WhatsNews/Details/5
      public ActionResult Details(int?id)
      {
          if (id == null)
          {
              return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
          }
          WhatsNew whatsNew = db.WhatsNews.Find(id);

          if (whatsNew == null)
          {
              return(HttpNotFound());
          }
          return(View(whatsNew));
      }
Exemplo n.º 11
0
      // GET: WhatsNews/Edit/5
      public ActionResult Edit(int?id)
      {
          if (id == null)
          {
              return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
          }
          WhatsNew whatsNew = db.WhatsNews.Find(id);

          if (whatsNew == null)
          {
              return(HttpNotFound());
          }
          ViewBag.ImageID = new SelectList(db.Images, "ImageID", "ImageName", whatsNew.ImageID);
          return(View(whatsNew));
      }
Exemplo n.º 12
0
        public void CustomerSaw(int whatsNewId, bool gotIt)
        {
            WhatsNew whatsNew = this.whatsNewRepository.Get(whatsNewId);

            if (whatsNew == null)
            {
                return;
            }

            this.whatsNewCustomerMapRepository.Save(new WhatsNewCustomerMap {
                Customer   = this.context.Customer,
                Date       = DateTime.UtcNow,
                Understood = gotIt,
                WhatsNew   = whatsNew
            });
        }         // CustomerSaw
Exemplo n.º 13
0
      public ActionResult Create([Bind(Include = "ID,HeaderText,Date,DisplayDate,ImageID,BodyText,Display,ImageSrc")] WhatsNew whatsNew)
      {
          if (ModelState.IsValid)
          {
              whatsNew.Date = DateTime.Now;



              db.WhatsNews.Add(whatsNew);
              db.SaveChanges();
              return(RedirectToAction("Index"));
          }

          ViewBag.ImageID = new SelectList(db.Images, "ImageID", "ImageName", whatsNew.ImageID);
          return(View(whatsNew));
      }
Exemplo n.º 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/whats_new.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oWhatsNew = new WhatsNew(intProfile, dsn);
     if (Request.QueryString["id"] == null)
     {
         panView.Visible = true;
         LoopRepeater();
     }
     else
     {
         panAdd.Visible = true;
         lngID          = Int32.Parse(Request.QueryString["id"]);
         if (!IsPostBack)
         {
             DataSet ds = oWhatsNew.Get(lngID);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 txtTitle.Text       = ds.Tables[0].Rows[0]["title"].ToString();
                 txtDescription.Text = ds.Tables[0].Rows[0]["description"].ToString();
                 txtAttachment.Text  = ds.Tables[0].Rows[0]["attachment"].ToString();
                 txtVersion.Text     = ds.Tables[0].Rows[0]["Version"].ToString();
                 txtCategory.Text    = ds.Tables[0].Rows[0]["Category"].ToString();
                 chkEnabled.Checked  = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                 btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=WHATSNEW" + "',false,400,400);");
                 btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
             }
             else
             {
                 btnOrder.Enabled  = false;
                 btnDelete.Enabled = false;
             }
         }
     }
     btnBrowse.Attributes.Add("onclick", "return OpenWindow('FILEBROWSER','" + txtAttachment.ClientID + "','',false,400,600);");
 }
Exemplo n.º 15
0
        private void ShowWhatsNewIfNecessary()
        {
            WhatsNew whatsNew = new WhatsNew(this);

            if (!whatsNew.ShouldShowWhatsNew)
            {
                return;
            }

            var alert = new AlertDialog.Builder(this)
                        .SetTitle(whatsNew.GetTitle())
                        .SetMessage(whatsNew.GetText())
                        .SetPositiveButton("Got it", (s, e) => { });

            RunOnUiThread(() =>
            {
                alert.Show();
            });

            whatsNew.Shown();
        }
Exemplo n.º 16
0
    //---------------------------------
    public void addWhatsNew(WhatsNew WN)
    {
        try
            {
                Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = DataBase;
                //Procedure Name.
                cmd.CommandText = "Add_WhatsNew";
                cmd.CommandType = CommandType.StoredProcedure;
                //Procedure Parameters.
                cmd.Parameters.Add("@SiteId", SqlDbType.Int);
                cmd.Parameters.Add("@ContId", SqlDbType.Int);
                cmd.Parameters.Add("@TitleID", SqlDbType.Int);
                cmd.Parameters.Add("@WhatHome", SqlDbType.Int);
                cmd.Parameters.Add("@WhatOrdPos", SqlDbType.Int);
                //Setting values to Parameters.
                cmd.Parameters[0].Value = WN.intSiteId;
                cmd.Parameters[1].Value = WN.intContId;
                cmd.Parameters[2].Value = WN.intTitleID;
                cmd.Parameters[3].Value = WN.intwhatHome;
                cmd.Parameters[4].Value = WN.intWhatOrdPos;
                cmd.ExecuteNonQuery();
                Close();
            }
            catch (SqlException oSqlExp)
            {
                //Console.WriteLine("" + oSqlExp.Message);

            }
            catch (Exception oEx)
            {
                //Console.WriteLine("" + oEx.Message);

            }
    }
Exemplo n.º 17
0
 public void Add(WhatsNew p)
 {
     data.WhatsNews.Add(p);
     data.SaveChanges();
 }
Exemplo n.º 18
0
 public void UpdateWhatsNew(WhatsNew whatsnew)
 {
     whatsnewRepository.Update(whatsnew);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Create a new WhatsNew object.
 /// </summary>
 /// <param name="siteId">Initial value of the SiteId property.</param>
 /// <param name="contId">Initial value of the ContId property.</param>
 /// <param name="whatId">Initial value of the WhatId property.</param>
 public static WhatsNew CreateWhatsNew(global::System.Int32 siteId, global::System.Int32 contId, global::System.Int32 whatId)
 {
     WhatsNew whatsNew = new WhatsNew();
     whatsNew.SiteId = siteId;
     whatsNew.ContId = contId;
     whatsNew.WhatId = whatId;
     return whatsNew;
 }
Exemplo n.º 20
0
 public void CreateWhatsNew(WhatsNew whatsnew)
 {
     whatsnewRepository.Add(whatsnew);
 }
        public IHttpActionResult Post([FromBody] BugFromEmail bugFromEmail)
        {
            if (bugFromEmail != null && ModelState.IsValid)
            {
                if (bugFromEmail.ShortDescription == null)
                {
                    bugFromEmail.ShortDescription = "";
                }
                else if (bugFromEmail.ShortDescription.Length > 200)
                {
                    bugFromEmail.ShortDescription = bugFromEmail.ShortDescription.Substring(0, 200);
                }

                Message mimeMessage = null;

                if (!string.IsNullOrEmpty(bugFromEmail.Message))
                {
                    mimeMessage = Mime.GetMimeMessage(bugFromEmail.Message);

                    bugFromEmail.Comment = Mime.get_comment(mimeMessage);

                    string headers = Mime.get_headers_for_comment(mimeMessage);
                    if (headers != "")
                    {
                        bugFromEmail.Comment = string.Format("{0}{1}{2}", headers, Environment.NewLine, bugFromEmail.Comment);
                    }

                    bugFromEmail.FromAddress = Mime.get_from_addr(mimeMessage);
                }
                else
                {
                    if (bugFromEmail.Comment == null)
                    {
                        bugFromEmail.Comment = string.Empty;
                    }
                }

                // Even though btnet_service.exe has already parsed out the bugid,
                // we can do a better job here with SharpMimeTools.dll
                string subject = "";

                if (mimeMessage != null)
                {
                    subject = Mime.get_subject(mimeMessage);

                    if (subject != "[No Subject]")
                    {
                        bugFromEmail.BugId = Mime.get_bugid_from_subject(ref subject);
                    }

                    bugFromEmail.CcAddress = Mime.get_cc(mimeMessage);
                }

                SQLString sql;

                if (bugFromEmail.BugId != 0)
                {
                    // Check if the bug is still in the database
                    // No comment can be added to merged or deleted bugids
                    // In this case a new bug is created, this to prevent possible loss of information

                    sql = new SQLString(@"select count(bg_id)
			from bugs
			where bg_id = @id"            );

                    sql = sql.AddParameterWithValue("id", Convert.ToString(bugFromEmail.BugId));

                    if (Convert.ToInt32(DbUtil.execute_scalar(sql)) == 0)
                    {
                        bugFromEmail.BugId = 0;
                    }
                }


                // Either insert a new bug or append a commment to existing bug
                // based on presence, absence of bugid
                if (bugFromEmail.BugId == 0)
                {
                    // insert a new bug

                    if (mimeMessage != null)
                    {
                        // in case somebody is replying to a bug that has been deleted or merged
                        subject = subject.Replace(Util.get_setting("TrackingIdString", "DO NOT EDIT THIS:"), "PREVIOUS:");

                        bugFromEmail.ShortDescription = subject;
                        if (bugFromEmail.ShortDescription.Length > 200)
                        {
                            bugFromEmail.ShortDescription = bugFromEmail.ShortDescription.Substring(0, 200);
                        }
                    }

                    DataRow defaults = Bug.get_bug_defaults();

                    // If you didn't set these from the query string, we'll give them default values
                    if (!bugFromEmail.ProjectId.HasValue || bugFromEmail.ProjectId == 0)
                    {
                        bugFromEmail.ProjectId = (int)defaults["pj"];
                    }
                    bugFromEmail.OrganizationId = bugFromEmail.OrganizationId ?? User.Identity.GetOrganizationId();
                    bugFromEmail.CategoryId     = bugFromEmail.CategoryId ?? (int)defaults["ct"];
                    bugFromEmail.PriorityId     = bugFromEmail.PriorityId ?? (int)defaults["pr"];
                    bugFromEmail.StatusId       = bugFromEmail.StatusId ?? (int)defaults["st"];
                    bugFromEmail.UdfId          = bugFromEmail.UdfId ?? (int)defaults["udf"];

                    // but forced project always wins
                    if (User.Identity.GetForcedProjectId() != 0)
                    {
                        bugFromEmail.ProjectId = User.Identity.GetForcedProjectId();
                    }

                    Bug.NewIds newIds = Bug.insert_bug(
                        bugFromEmail.ShortDescription,
                        User.Identity,
                        "", // tags
                        bugFromEmail.ProjectId.Value,
                        bugFromEmail.OrganizationId.Value,
                        bugFromEmail.CategoryId.Value,
                        bugFromEmail.PriorityId.Value,
                        bugFromEmail.StatusId.Value,
                        bugFromEmail.AssignedTo ?? 0,
                        bugFromEmail.UdfId.Value,
                        bugFromEmail.Comment,
                        bugFromEmail.Comment,
                        bugFromEmail.FromAddress,
                        bugFromEmail.CcAddress,
                        "text/plain",
                        false,  // internal only
                        null,   // custom columns
                        false); // suppress notifications for now - wait till after the attachments

                    if (mimeMessage != null)
                    {
                        Mime.add_attachments(mimeMessage, newIds.bugid, newIds.postid, User.Identity);

                        Email.auto_reply(newIds.bugid, bugFromEmail.FromAddress, bugFromEmail.ShortDescription, bugFromEmail.ProjectId.Value);
                    }
                    else if (bugFromEmail.Attachment != null && bugFromEmail.Attachment.Length > 0)
                    {
                        Stream stream = new MemoryStream(bugFromEmail.Attachment);

                        Bug.insert_post_attachment(
                            User.Identity,
                            newIds.bugid,
                            stream,
                            bugFromEmail.Attachment.Length,
                            bugFromEmail.AttachmentFileName ?? string.Empty,
                            bugFromEmail.AttachmentDescription ?? string.Empty,
                            bugFromEmail.AttachmentContentType ?? string.Empty,
                            -1,     // parent
                            false,  // internal_only
                            false); // don't send notification yet
                    }

                    // your customizations
                    Bug.apply_post_insert_rules(newIds.bugid);

                    Bug.send_notifications(Bug.INSERT, newIds.bugid, User.Identity);
                    WhatsNew.add_news(newIds.bugid, bugFromEmail.ShortDescription, "added", User.Identity);

                    return(Ok(newIds.bugid));
                }
                else // update existing bug
                {
                    string statusResultingFromIncomingEmail = Util.get_setting("StatusResultingFromIncomingEmail", "0");


                    if (statusResultingFromIncomingEmail != "0")
                    {
                        sql = new SQLString(@"update bugs
				set bg_status = @st
				where bg_id = @bg
				"                );

                        sql = sql.AddParameterWithValue("st", statusResultingFromIncomingEmail);
                        sql = sql.AddParameterWithValue("bg", bugFromEmail.BugId);
                        DbUtil.execute_nonquery(sql);
                    }

                    sql = new SQLString("select bg_short_desc from bugs where bg_id = @bg");

                    sql = sql.AddParameterWithValue("bg", bugFromEmail.BugId);
                    DataRow dr2 = DbUtil.get_datarow(sql);


                    // Add a comment to existing bug.
                    int postid = Bug.insert_comment(
                        bugFromEmail.BugId,
                        User.Identity.GetUserId(), // (int) dr["us_id"],
                        bugFromEmail.Comment,
                        bugFromEmail.Comment,
                        bugFromEmail.FromAddress,
                        bugFromEmail.CcAddress,
                        "text/plain",
                        false); // internal only

                    if (mimeMessage != null)
                    {
                        Mime.add_attachments(mimeMessage, bugFromEmail.BugId, postid, User.Identity);
                    }
                    else if (bugFromEmail.Attachment != null && bugFromEmail.Attachment.Length > 0)
                    {
                        Stream stream = new MemoryStream(bugFromEmail.Attachment);
                        Bug.insert_post_attachment(
                            User.Identity,
                            bugFromEmail.BugId,
                            stream,
                            bugFromEmail.Attachment.Length,
                            bugFromEmail.AttachmentFileName ?? string.Empty,
                            bugFromEmail.AttachmentDescription ?? string.Empty,
                            bugFromEmail.AttachmentContentType ?? string.Empty,
                            -1,     // parent
                            false,  // internal_only
                            false); // don't send notification yet
                    }

                    Bug.send_notifications(Bug.UPDATE, bugFromEmail.BugId, User.Identity);
                    WhatsNew.add_news(bugFromEmail.BugId, (string)dr2["bg_short_desc"], "updated", User.Identity);

                    return(Ok(bugFromEmail.BugId));
                }
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
Exemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Reload();
            }
            oPlatform         = new Platforms(intProfile, dsn);
            oOrganization     = new Organizations(intProfile, dsn);
            oRequestItem      = new RequestItems(intProfile, dsn);
            oUserAt           = new Users_At(intProfile, dsn);
            oCost             = new Costs(intProfile, dsn);
            oService          = new Services(intProfile, dsn);
            oRequestField     = new RequestFields(intProfile, dsn);
            oReport           = new Reports(intProfile, dsn);
            oSites            = new Sites(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oRacks            = new Racks(intProfile, dsn);
            oBanks            = new Banks(intProfile, dsn);
            oDepot            = new Depot(intProfile, dsn);
            oShelf            = new Shelf(intProfile, dsn);
            oClasses          = new Classes(intProfile, dsn);
            oRooms            = new Rooms(intProfile, dsn);
            oFloor            = new Floor(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oSolution         = new Solution(intProfile, dsn);
            oConfidence       = new Confidence(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oField            = new Field(intProfile, dsn);
            oServiceDetail    = new ServiceDetails(intProfile, dsn);
            oDomainController = new DomainController(intProfile, dsn);
            oDomain           = new Domains(intProfile, dsn);
            oServerName       = new ServerName(intProfile, dsn);
            oOperatingSystems = new OperatingSystems(intProfile, dsn);
            oOnDemand         = new OnDemand(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oHost             = new Host(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            oRestart          = new Restart(intProfile, dsn);
            oSegment          = new Segment(intProfile, dsn);
            oServiceEditor    = new ServiceEditor(intProfile, dsnServiceEditor);
            oProjectRequest   = new ProjectRequest(intProfile, dsn);
            oVMWare           = new VMWare(intProfile, dsn);
            oWorkstation      = new Workstations(intProfile, dsn);
            //oNew = new New(intProfile, dsn);
            oWhatsNew          = new WhatsNew(intProfile, dsn);
            oMaintenanceWindow = new MaintenanceWindow(intProfile, dsn);
            //oRecoveryLocations = new RecoveryLocations(intProfile, dsn);
            oTSM         = new TSM(intProfile, dsn);
            oDNS         = new DNS(intProfile, dsn);
            oSolaris     = new Solaris(intProfile, dsn);
            oZeus        = new Zeus(intProfile, dsn);
            oError       = new Errors(intProfile, dsn);
            oDesign      = new Design(intProfile, dsn);
            oResiliency  = new Resiliency(intProfile, dsn);
            oEnhancement = new Enhancements(intProfile, dsn);

            if (Request.QueryString["type"] != null && Request.QueryString["type"] != "")
            {
                lblType.Text = Request.QueryString["type"];
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                lblId.Text = Request.QueryString["id"];
            }
            string strControl = "";

            if (Request.QueryString["control"] != null)
            {
                strControl = Request.QueryString["control"];
            }
            btnSave.Attributes.Add("onclick", "return Update('hdnUpdateOrder','" + strControl + "');");
            btnClose.Attributes.Add("onclick", "return HidePanel();");
            imgOrderUp.Attributes.Add("onclick", "return MoveOrderUp(" + lstOrder.ClientID + ");");
            imgOrderDown.Attributes.Add("onclick", "return MoveOrderDown(" + lstOrder.ClientID + ");");
            LoadList();
        }
Exemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ((CommunityMasterPage)this.Master).DisabledSidePanel = true;

            this.Title = Resources.CommunityResource.MainPageTitle;

            if (ShowEmptyScreen())
            {
                var dashboardEmptyScreen = (DashboardEmptyScreen)Page.LoadControl(DashboardEmptyScreen.Location);

                AddContent.Controls.Add(dashboardEmptyScreen);

                return;
            }


            _widgetTabControl = new WidgetTab(new Guid("{57DAD9FA-BBB8-4a3a-B208-D3CD58691D35}"),
                                              ColumnSchemaType.Schema_25_50_25,
                                              "communityDashboard"
                                              );

            var modules = new List <ASC.Web.Core.ModuleManagement.Module>();

            foreach (var item in WebItemManager.Instance.GetSubItems(CommunityProduct.ID))
            {
                if ((item is ASC.Web.Core.ModuleManagement.Module) == false)
                {
                    continue;
                }

                var module = item as ASC.Web.Core.ModuleManagement.Module;
                modules.Add(module);


                foreach (var widget in module.Widgets)
                {
                    try
                    {
                        _widgetTabControl.WidgetCollection.Add(GetWidgetControl(module, widget));
                    }
                    catch (Exception ex)
                    {
                        //TODO: draw error control or something
                        _widgetTabControl.WidgetCollection.Add(GetBrokenWidgetControl(ex));
                    }
                }
            }

            _widgetTabControl.WidgetCollection.Add(new Widget(BirthdayReminderWidget.WidgetID,
                                                              new BirthdayReminderWidget()
            {
                ProductID = CommunityProduct.ID
            },
                                                              Resources.CommunityResource.BirthdayReminderWidgetName,
                                                              Resources.CommunityResource.BirthdayReminderWidgetDescription)
            {
                ImageURL             = WebImageSupplier.GetAbsoluteWebPath("birthday_widget.png"),
                SettingsProviderType = typeof(StudioWidgetSettingsProvider),
                UsePositionAttribute = true
            });

            _widgetTabControl.WidgetCollection.Add(new Widget(NewEmployeeWidget.WidgetID,
                                                              new NewEmployeeWidget()
            {
                ProductID = CommunityProduct.ID
            },
                                                              CustomNamingPeople.Substitute <Resources.CommunityResource>("NewEmployeeWidgetName"),
                                                              Resources.CommunityResource.NewEmployeeWidgetDescription)
            {
                ImageURL             = WebImageSupplier.GetAbsoluteWebPath("newemp_widget.png"),
                SettingsProviderType = typeof(StudioWidgetSettingsProvider),
                UsePositionAttribute = true
            });

            var widgetSettings = SettingsManager.Instance.LoadSettingsFor <ProductActivityWidgetSettings>(SecurityContext.CurrentAccount.ID);

            ProductActivity productActivityControl = (ProductActivity)LoadControl(ProductActivity.Location);

            productActivityControl.ProductId  = CommunityProduct.ID;
            productActivityControl.Activities = UserActivityManager.GetUserActivities(
                TenantProvider.CurrentTenantID, null, CommunityProduct.ID, null, UserActivityConstants.ContentActionType, null, 0, widgetSettings.CountActivities)
                                                .ConvertAll(a => new UserContentActivity(a));


            _widgetTabControl.WidgetCollection.Add(new Widget(ProductActivity.WidgetID,
                                                              productActivityControl,
                                                              Resources.CommunityResource.CommunityActivityWidgetName,
                                                              Resources.CommunityResource.CommunityActivityWidgetDescription)
            {
                ImageURL             = WebImageSupplier.GetAbsoluteWebPath("lastadded_widget.png"),
                SettingsProviderType = typeof(StudioWidgetSettingsProvider),
                Position             = new Point(0, 2),
                WidgetURL            = WhatsNew.GetUrlForModule(Product.CommunityProduct.ID, null)
            });


            WidgetsContent.Controls.Add(_widgetTabControl);

            NavigationPanel NavigationPanel = (NavigationPanel)this.LoadControl(NavigationPanel.Location);

            NavigationPanelContent.Controls.Add(NavigationPanel);

            if (SecurityContext.CurrentAccount.IsAuthenticated)
            {
                NavigationPanel.addButton(Resources.CommunityResource.BtnCustomizeWidgets, WebImageSupplier.GetAbsoluteWebPath("btn_managewidgets.png"), "javascript:communityDashboard.ShowSettings()", 3);
                if (modules.Count > 0)
                {
                    NavigationPanel.addButton(Resources.CommunityResource.BtnAddContent, WebImageSupplier.GetAbsoluteWebPath("btn_addcontent.png"), "javascript:StudioManager.ShowAddContentDialog()", 2);
                    AddContentControl AddCntnt = (AddContentControl)this.LoadControl(AddContentControl.Location);

                    foreach (var module in modules)
                    {
                        try
                        {
                            AddCntnt.Types.Add(new AddContentControl.ContentTypes {
                                Link = module.Context.GetCreateContentPageAbsoluteUrl(), Icon = (module as IWebItem).GetIconAbsoluteURL(), Label = module.Name
                            });
                        }
                        catch (Exception)
                        {
                            AddCntnt.Types.Add(new AddContentControl.ContentTypes {
                                Link = "#", Icon = string.Empty, Label = "Error loading " + module.Name
                            });
                        }
                    }


                    AddContent.Controls.Add(AddCntnt);
                }
            }
        }
Exemplo n.º 24
0
 public void Edit(WhatsNew p)
 {
     data.Entry(p).State = System.Data.Entity.EntityState.Modified;
 }
Exemplo n.º 25
0
 /// <summary>
 /// Deprecated Method for adding a new object to the WhatsNews EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToWhatsNews(WhatsNew whatsNew)
 {
     base.AddObject("WhatsNews", whatsNew);
 }
 //------------------------------------------------------------
 private void SaveFeatureProducts(int count)
 {
     string vsub;
     int isub;
     int whathome = 0;
     string search = Convert.ToString(Request["txtPosition"]);
     if (Request["Home"] != null)
     {
         whathome = 1;
     }
     else
     {
         whathome = 0;
     }
     if (validationpos(search) == true)
     {
         for (int i = 0; i <= count; i++)
         {
             vsub = Request["chk" + i];
             isub = Convert.ToInt32(vsub);
             if (vsub != null)
             {
                 if (validateId(isub) == false)
                 {
                     WhatsNew feat = new WhatsNew(Convert.ToInt32(Session["siteId"]), Convert.ToInt32(Session["contId"]), isub,whathome, Convert.ToInt32(search), true);
                     addWhatsNew(feat);
                     if (Request["Home"] != null)
                     {
                         Response.Redirect("mnt_WhatsNew.aspx?Home=" + true);
                     }
                     else
                     {
                         Response.Redirect("mnt_WhatsNew.aspx");
                     }
                 }
                 else
                 {
                     lbPositionError.Text = "**This product is already feature product**";
                     lbPositionError.Visible = true;
                 }
             }
         }
     }
     else
     {
         lbPositionError.Text = "**" + search + "is an invalid position**";
         lbPositionError.Visible = true;
     }
 }
Exemplo n.º 27
0
 private void WhatsNew_Click(object sender, RoutedEventArgs e)
 {
     WhatsNew wn = new WhatsNew();
     wn.ShowDialog();
 }