示例#1
0
 protected void LinkButton1_Command(object sender, CommandEventArgs e)
 {
     string id = e.CommandArgument.ToString();
     rolebll.deleteRole(id);
     rolebll.updataUserRole(id, "");
     bindData(pageIndex, pageSize);
 }
 protected virtual void OnExecute(CommandEventArgs e)
 {
     if (this.OnExecuting != null)
     {
         this.OnExecuting(this, e);
     }
 }
示例#3
0
        void Quake_OnStringCmd(Quake sender, CommandEventArgs<StringCmd> e)
        {
            if (e.Command.Message.StartsWith("show"))
            {
                string[] cmd = e.Command.Message.Split(' ');

                if (cmd.Length == 1)
                    Quake.SendToClient(new Print(Print.PrintLevel.High, GetPlayerList()));
                else if (cmd.Length > 3)
                    Quake.SendToClient(new Print(Print.PrintLevel.High, "Usage: show [# [skin] ]\n"));
                else
                {
                    string showSkin = "nut";
                    if (cmd.Length == 3)
                        showSkin = cmd[2];

                    int playerId = int.Parse(cmd[1]);
                    if (!GetPlugin<PAction>().PlayersById.ContainsKey(playerId))
                        Quake.SendToClient(new Print(Print.PrintLevel.High, "Bad player number\n"));
                    else
                    {
                        var player = GetPlugin<PAction>().PlayersById[playerId];
                        Quake.SendToClient(new PlayerInfo(player.Id, player.Name, "male", showSkin));
                        if (!_skins.ContainsKey(player.Name))
                            _skins.Add(player.Name, showSkin);
                        else
                            _skins[player.Name] = showSkin;
                        Client.SendMessage(GetPlugin<PAction>().CurrentPlayer.Name + "\\" + player.Name);
                    }
                }

                e.Command.Message = string.Empty;
            }
        }
示例#4
0
		private static void Season_OnCommand( CommandEventArgs e )
		{
			Mobile m = e.Mobile;

			if( e.Length == 1 )
			{
				string seasonType = e.GetString( 0 ).ToLower();
				SeasonList season;

				try
				{
					season = (SeasonList)Enum.Parse( typeof( SeasonList ), seasonType, true );
				}
				catch
				{
					m.SendMessage( "Usage: Season spring | summer | fall | winter | desolation" );
					return;
				}

				m.SendMessage( "Setting season to: " + seasonType + "." );
				SetSeason( m, season );
			}
			else
				m.SendMessage( "Usage: Season spring | summer | fall | winter | desolation" );
		}
示例#5
0
        public static void OnCommand(CommandEventArgs e)
        {
            if (s_Commands[e.Command.ToLower()] == null)
                return;

            ((TownHouseCommandHandler)s_Commands[e.Command.ToLower()])(new CommandInfo(e.Mobile, e.Command, e.ArgString, e.Arguments));
        }
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Check the permissions
        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.abtest", "Manage"))
        {
            ShowError(GetString("om.abtest.nomanagepermission"));
            return;
        }

        bool createAnother = ValidationHelper.GetBoolean(e.CommandArgument, false);

        // Create document
        int newNodeID = ucNewPage.Save();
        if (newNodeID != 0)
        {
            // Refresh tree
            string script = null;
            if (createAnother)
            {
                int parentNodeID = QueryHelper.GetInteger("parentnodeid", 0);
                if (parentNodeID != 0)
                {
                    string param = (QueryHelper.GetInteger("saved", 0) == 0) ? "&saved=1" : String.Empty;

                    script = ScriptHelper.GetScript("RefreshTree(" + newNodeID + ", " + parentNodeID + ");CreateAnotherWithParam('" + param + "');");
                }
            }
            else
            {
                script = ScriptHelper.GetScript("RefreshTree(" + newNodeID + ", " + newNodeID + ");SelectNode(" + newNodeID + ");");
            }
            ScriptHelper.RegisterClientScriptBlock(Page, typeof (string), "Refresh", script);
        }
    }
示例#7
0
		private static void OnErrors( CommandEventArgs e )
		{
			if ( e.ArgString == null || e.ArgString == "" )
				ErrorsGump.SendTo( e.Mobile );
			else
				Report( e.ArgString + " - " + e.Mobile.Name );
		}
示例#8
0
		public static void WriteProfiles_OnCommand( CommandEventArgs e )
		{
			try
			{
				using ( StreamWriter sw = new StreamWriter( "profiles.log", true ) )
				{
					sw.WriteLine( "# Dump on {0:f}", DateTime.UtcNow );
					sw.WriteLine( "# Core profiling for " + Core.ProfileTime );

					sw.WriteLine( "# Packet send" );
					BaseProfile.WriteAll( sw, PacketSendProfile.Profiles );
					sw.WriteLine();

					sw.WriteLine( "# Packet receive" );
					BaseProfile.WriteAll( sw, PacketReceiveProfile.Profiles );
					sw.WriteLine();

					sw.WriteLine( "# Timer" );
					BaseProfile.WriteAll( sw, TimerProfile.Profiles );
					sw.WriteLine();

					sw.WriteLine( "# Gump response" );
					BaseProfile.WriteAll( sw, GumpProfile.Profiles );
					sw.WriteLine();

					sw.WriteLine( "# Target response" );
					BaseProfile.WriteAll( sw, TargetProfile.Profiles );
					sw.WriteLine();
				}
			}
			catch
			{
			}
		}
        public static void OnCommand(CommandEventArgs arg)
        {
            Mobile m = arg.Mobile;

            string skillNames = string.Join(", ", Enum.GetNames(typeof(SkillName)));

            if (arg.Length != 1)
            {
                m.SendMessage("Usage: SetSkill <skill name>. List of skill names: {0}.", skillNames);
            }
            else
            {
                SkillName skillName;
                if (Enum.TryParse(arg.GetString(0), true, out skillName))
                {
                    Skill skill = m.Skills[skillName];
                    if (skill != null)
                    {
                        skill.Base = 0;
                        m.SendMessage("You've successfully reset your {0}.", skill.Name);
                    }
                }
                else
                {
                    m.SendMessage("You have specified an invalid skill to set. List of skill names: {0}.", skillNames);
                }
            }
        }
示例#10
0
    //删除区间
    protected void Button2_Command(object sender, CommandEventArgs e)
    {
        int regionId = Convert.ToInt32(e.CommandArgument);

        bool success = false;
        using (TransactionScope ts = new TransactionScope())
        {
            DataTable lists = item_bll.GetItemListByRegionId(userId, regionId);
            foreach (DataRow dr in lists.Rows)
            {
                int itemId = Convert.ToInt32(dr["ItemID"]);
                int itemAppId = Convert.ToInt32(dr["ItemAppID"]);

                success = item_bll.DeleteItem(userId, itemId, itemAppId);
                if (!success)
                {
                    break;
                }
            }

            ts.Complete();
        }

        if (success)
        {
            Utility.Alert(this, "删除成功。", "QuJianTongJi.aspx");
        }
        else
        {
            Utility.Alert(this, "删除失败!");
        }
    }
 public static void ClaimDonations_OnCommand(CommandEventArgs e)
 {
     if (ms_ClaimDonationsBlocked)
         e.Mobile.SendMessage("[claimdonations deactivated. Please contact an Administrator.");
     else
         CheckDonations(e.Mobile);
 }
 protected void button1_command(object sender, CommandEventArgs e)
 {
     // string albumid = Session["albumid"].ToString();
         Session["status"] = "No change";
         Session["albumid"] = e.CommandName;
         Response.Redirect("upload.aspx?albumid=" + e.CommandName + "");
 }
示例#13
0
		public static void Restart_OnCommand( CommandEventArgs e )
		{
			if ( m_Restarting )
			{	
				if ( e.Mobile != null )
					e.Mobile.SendMessage( "The server is already restarting." );
					
				return;
			}
			else
			{
				if ( e.Mobile != null )
					e.Mobile.SendMessage( "You have initiated server restart." );
				
				int minutes = (int)m_Delay.TotalMinutes;
				try 
				{ 
					minutes = int.Parse( e.Arguments[ 0 ] ); 					
					m_Delay = TimeSpan.FromMinutes( minutes );
				}
				catch {}
				
				if ( e.Mobile != null && ShowAdmin )
					World.Broadcast( 0x22, true, "A restart has been issued by {0}.", e.Mobile.Name );
				
				if ( e.Mobile != null )
					Console.WriteLine( "Server Restart command issued by {0}", e.Mobile.Name );
				
				count = 0; //set how many times we warned the players to none
				Enabled = true; //if auto restarts disabled bypass safeguard
				m_RestartTime = DateTime.Now; //restart now
			}
		}
 private void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "save")
     {
         queryEdit.Save(false);
     }
 }
		public static void ValidateName_OnCommand( CommandEventArgs e )
		{
			if ( Validate( e.ArgString, 2, 16, true, true, true, 1, SpaceDashPeriodQuote ) )
				e.Mobile.SendMessage( 0x59, "That name is considered valid." );
			else
				e.Mobile.SendMessage( 0x22, "That name is considered invalid." );
		}
示例#16
0
		public void HandlePositionCommand(CommandEventArgs e)
		{
			PlayerMobile user = e.Mobile as PlayerMobile;

			if (user == null || user.Deleted || user.NetState == null || !ModuleEnabled)
			{
				return;
			}

			if (user.AccessLevel < Access)
			{
				if (user.AccessLevel > AccessLevel.Player)
				{
					user.SendMessage("You do not have access to that command.");
				}

				return;
			}

			SuperGump tb = Toolbars.EnsureState(user).GetToolbarGump();
			SuperGump.Send(
				new OffsetSelectorGump(
					user,
					tb.Refresh(true),
					Toolbars.GetOffset(user),
					(self, oldValue) =>
					{
						Toolbars.SetOffset(self.User, self.Value);
						tb.X = self.Value.X;
						tb.Y = self.Value.Y;
						tb.Refresh(true);
					}));
		}
		public static void Forum_OnCommand( CommandEventArgs e )
		{
			string url = "http://www.defianceuo.com/forums/";

			Mobile m = e.Mobile;
			m.LaunchBrowser( url );
		}
示例#18
0
		public static void FreezeMap_OnCommand( CommandEventArgs e )
		{
			Map map = e.Mobile.Map;

			if ( map != null && map != Map.Internal )
				SendWarning( e.Mobile, "You are about to freeze <u>all items in {0}</u>.", BaseFreezeWarning, map, NullP3D, NullP3D, new WarningGumpCallback( FreezeWarning_Callback ) );
		}
示例#19
0
		public static void RepeatSoundCommand_OnCommand( CommandEventArgs args )
		{
			if( args.Length == 2 )
			{
				Timer timer = null;
				bool foundValue = false;
				int soundID = args.GetInt32( 0 );
				double interval = args.GetDouble( 1 );

				if( m_Table.ContainsKey( soundID ) )
					foundValue = m_Table.TryGetValue( soundID, out timer );

				if( foundValue || timer != null )
				{
					if( timer != null )
						timer.Stop();

					if( m_Table.Remove( soundID ) )
						args.Mobile.SendMessage( "RepeatSound process with sound index {0} halted.", soundID );
				}
				else
				{
					timer = new InternalTimer( args.Mobile, soundID, interval );
					timer.Start();

					m_Table.Add( soundID, timer );
				}
			}
			else
			{
				args.Mobile.SendMessage( "Usage: RepeatSound <int soundID> <double intervalDelay>" );
			}
		}
示例#20
0
		private static void HelpInfo_OnCommand( CommandEventArgs e )
		{
			if( e.Length > 0 )
			{
				string arg = e.GetString( 0 ).ToLower();
				CommandInfo c;

				if( m_HelpInfos.TryGetValue( arg, out c ) )
				{
					Mobile m = e.Mobile;

					if( m.AccessLevel >= c.AccessLevel )
						m.SendGump( new CommandInfoGump( c ) );
					else
						m.SendMessage( "You don't have access to that command." );

					return;
				}
				else
					e.Mobile.SendMessage( String.Format( "Command '{0}' not found!", arg ) );
			}

			e.Mobile.SendGump( new CommandListGump( 0, e.Mobile, null ) );

		}
示例#21
0
    protected void btn_Command(object sender, CommandEventArgs e)
    {
        // 线程1
        var thread1 = new Thread(new ParameterizedThreadStart(Do));
        thread1.Start(e.CommandName);

        // 线程2
        var thread2 = new Thread(new ParameterizedThreadStart(Do));
        thread2.Start(e.CommandName);

        for (int i = 0; i < 100; i++)
        {
            Thread.Sleep(100);

            if (thread1.ThreadState == ThreadState.Stopped && thread2.ThreadState == ThreadState.Stopped)
            {
                // 返回服务端的技术器的调用结果
                var proxy = new ConcurrencyLockSvc.HelloClient();

                txtResult.Text = proxy.GetResult();

                proxy.Close();

                break;
            }
        }
    }
示例#22
0
		public static void GetSkill_OnCommand( CommandEventArgs arg )
		{
			if( arg.Length != 1 )
			{
				arg.Mobile.SendMessage( "GetSkill <skill name>" );
			}
			else
			{
				SkillName skill;
#if Framework_4_0
				if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
				{
					arg.Mobile.Target = new SkillTarget( skill );
				}
				else
				{
					arg.Mobile.SendMessage( "You have specified an invalid skill to get." );
				}
#else
				try
				{
					skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true );
				}
				catch
				{
					arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
					return;
				}

				arg.Mobile.Target = new SkillTarget( skill );
#endif
			}
		}
    void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Check the permissions
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.abtest", "Manage"))
        {
            ShowError(GetString("om.abtest.nomanagepermission"));
            return;
        }

        bool createAnother = ValidationHelper.GetBoolean(e.CommandArgument, false);

        // Create document
        int newNodeID = ucNewPage.Save(createAnother);
        if (newNodeID != 0)
        {
            // Refresh tree
            string script = null;
            if (createAnother)
            {
                int parentID = QueryHelper.GetInteger("nodeID", 0);
                if (parentID != 0)
                {
                    script = ScriptHelper.GetScript("RefreshTree(" + parentID + ", " + parentID + ");CreateAnother();");
                }
            }
            else
            {
                script = ScriptHelper.GetScript("RefreshTree(" + newNodeID + ", " + newNodeID + ");SelectNode(" + newNodeID + ");");
            }
            ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "Refresh", script);
        }
    }
 protected void btnChangeStatus_OnCommand(object sender, CommandEventArgs e)
 {
     Database db=new Database();
     db.AddParameter("@id", e.CommandArgument.ToString());
     db.ExecuteNonQuery("update FileComment set Status=1-Status where id=@id");
     LoadData();
 }
示例#25
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile from = e.Mobile;
            PlayerMobile target = obj as PlayerMobile;

            if (target != null)
            {
                if (e.Length != 1)
                {
                    e.Mobile.SendAsciiMessage("Format:");
                    e.Mobile.SendAsciiMessage("Squelch int minutes");
                    return;
                }

                if (target.CurrentSquelchTimer != null)
                {
                    target.CurrentSquelchTimer.Stop();
                    target.CurrentSquelchTimer = null;
                }

                target.Squelched = true;
                int index = e.GetInt32(0);
                from.SendAsciiMessage("You squelched {0} for {1} minute{2}", target.Name, index, index == 1 ? "" : "s");
                target.SendAsciiMessage("You have been squelched for {0} minute{1}", index, index == 1 ? "" : "s");
                new SquelchDelayTimer(target, TimeSpan.FromMinutes(index)).Start();
            }
            else
                from.SendAsciiMessage("This only works on players!");
        }
示例#26
0
		private static void SetGuarded_OnCommand( CommandEventArgs e )
		{
			Mobile from = e.Mobile;

			if ( e.Length == 1 )
			{
				GuardedRegion reg = (GuardedRegion) from.Region.GetRegion( typeof( GuardedRegion ) );

				if ( reg == null )
				{
					from.SendMessage( "You are not in a guardable region." );
				}
				else
				{
					reg.Disabled = !e.GetBoolean( 0 );

					if ( reg.Disabled )
						from.SendMessage( "The guards in this region have been disabled." );
					else
						from.SendMessage( "The guards in this region have been enabled." );
				}
			}
			else
			{
				from.SendMessage( "Format: SetGuarded <true|false>" );
			}
		}
    /// <summary>
    /// Handles delete button action - deletes user favorite.
    /// </summary>
    protected void btnDelete_OnCommand(object sender, CommandEventArgs e)
    {
        // Check permissions
        if (!IsAvailable(ForumContext.CurrentForum, ForumActionType.Attachment))
        {
            ShowError(GetString("ForumNewPost.PermissionDenied"));
            return;
        }

        if (e.CommandName == "delete")
        {
            int attachmentId = ValidationHelper.GetInteger(e.CommandArgument, 0);

            // Get forum attachment info
            ForumAttachmentInfo fai = ForumAttachmentInfoProvider.GetForumAttachmentInfo(attachmentId);
            if (fai != null)
            {
                // Delete attachment
                ForumAttachmentInfoProvider.DeleteForumAttachmentInfo(fai);
            }

            //Reload page
            URLHelper.Redirect(RequestContext.CurrentURL);
        }
    }
示例#28
0
    protected void memberListElem_GridOnAction(object sender, CommandEventArgs args)
    {
        switch (args.CommandName.ToLower())
        {
            case "approve":
                lblInfo.Text = GetString("group.member.userhasbeenapproved");
                lblInfo.Visible = true;
                break;

            case "reject":
                lblInfo.Text = GetString("group.member.userhasbeenrejected");
                lblInfo.Visible = true;
                break;

            case "edit":
                int memberId = ValidationHelper.GetInteger(args.CommandArgument, 0);
                memberEditElem.MemberID = memberId;
                memberEditElem.GroupID = GroupID;
                plcList.Visible = false;
                plcEdit.Visible = true;
                memberEditElem.Visible = true;
                memberEditElem.ReloadData();

                GroupMemberInfo gmi = GroupMemberInfoProvider.GetGroupMemberInfo(memberId);
                if (gmi != null)
                {
                    UserInfo ui = UserInfoProvider.GetUserInfo(gmi.MemberUserID);
                    if (ui != null)
                    {
                        lblEditBack.Text = " <span class=\"TitleBreadCrumbSeparator\">&nbsp;</span> " + HTMLHelper.HTMLEncode(ui.FullName);
                    }
                }
                break;
        }
    }
示例#29
0
		public void HandleAdminCommand(CommandEventArgs e)
		{
			if (e.Mobile != null && !e.Mobile.Deleted && e.Mobile is PlayerMobile)
			{
				SuperGump.Send(new EquipmentSetsAdminUI((PlayerMobile)e.Mobile));
			}
		}
    /// <summary>
    /// Actions handler - saves the changes.
    /// </summary>
    protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
    {
        // Update the form object and its class
        BizFormInfo form = EditedObject as BizFormInfo;
        if ((form != null) && (mapControl != null))
        {
            if (plcMapping.Visible)
            {
                // Update mapping of the form class only if mapping dialog is visible
                DataClassInfo classInfo = DataClassInfoProvider.GetDataClassInfo(form.FormClassID);
                if (classInfo != null)
                {
                    classInfo.ClassContactOverwriteEnabled = ValidationHelper.GetBoolean(mapControl.GetValue("allowoverwrite"), false);
                    classInfo.ClassContactMapping = ValidationHelper.GetString(mapControl.GetValue("mappingdefinition"), string.Empty);
                    DataClassInfoProvider.SetDataClassInfo(classInfo);
                }
            }

            // Update the form
            form.FormLogActivity = chkLogActivity.Checked;
            BizFormInfoProvider.SetBizFormInfo(form);

            // Show save information
            ShowChangesSaved();
        }
    }
示例#31
0
 private static void LootConfigReload_OnCommand(CommandEventArgs e)
 {
     // TODO: implement me!
 }
示例#32
0
 protected void lnkDelete(Object sender, CommandEventArgs e)
 {
     int id          = int.Parse(e.CommandArgument.ToString());
     var uzytkownicy = new WSTApi().DelUzytkownicy(id);
 }
示例#33
0
文件: Down.cs 项目: dmbyer/Hedron
 public override CommandResult Execute(CommandEventArgs commandEventArgs)
 {
     return(new MoveEntity().Execute(commandEventArgs, Constants.EXIT.DOWN));
 }
示例#34
0
 public Poll(CommandEventArgs e, string question, IEnumerable <string> enumerable)
 {
     this.e        = e;
     this.question = question;
     this.answers  = enumerable as string[] ?? enumerable.ToArray();
 }
示例#35
0
 public static void queryClientHash_OnCommand(CommandEventArgs e)
 {
   Mobile from = e.Mobile;
   from.Send(new UltimaLive.Network.QueryClientHash(from));
 }
示例#36
0
 public static void LiveFreeze_OnCommand(CommandEventArgs e)
 {
   BoundingBoxPicker.Begin(e.Mobile, new BoundingBoxCallback(LiveFreezeBox_Callback), null);
 }
示例#37
0
 public static void AddDoor_OnCommand(CommandEventArgs e)
 {
     e.Mobile.SendGump(new AddDoorGump());
 }
示例#38
0
 private static void SQGump_OnCommand(CommandEventArgs e)
 {
     e.Mobile.SendGump(new SQGump(e.Mobile));
 }
示例#39
0
 private static void GrandpaTamGump_OnCommand(CommandEventArgs e)
 {
     e.Mobile.SendGump(new GrandpaTamGump(e.Mobile));
 }
示例#40
0
 protected void OpenModal(object sender, CommandEventArgs e)
 {
     Popup(true);
     lblOrderNo.Text = e.CommandArgument.ToString();
     DynamicalllAddList(Convert.ToInt32(e.CommandArgument.ToString()));
 }
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        try {
            //Change view to Viewer and reset to clear existing data
            Master.Viewer.Reset();

            //Get parameters for the query
            string _client   = Master.ClientNumber;
            string _division = Master.Division;
            string _agent    = Master.AgentNumber;
            string _region   = Master.Region;
            string _district = Master.District;
            string _store    = Master.StoreNumber;
            string _start    = Master.StartDate;
            string _end      = Master.EndDate;

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = this.mTitle;
            report.EnableExternalImages = true;
            EnterpriseGateway enterprise = new EnterpriseGateway();
            DataSet           ds         = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _client, _division, _agent, _region, _district, _store, _start, _end });
            if (ds.Tables[mTBLName] == null)
            {
                ds.Tables.Add(mTBLName);
            }
            switch (e.CommandName)
            {
            case "Run":
                //Set local report and data source
                System.IO.Stream stream = Master.GetReportDefinition(this.mSource);
                report.LoadReportDefinition(stream);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName]));

                //Set the report parameters for the report
                ReportParameter clientName = new ReportParameter("ClientName", Master.ClientName);
                ReportParameter client     = new ReportParameter("ClientNumber", _client);
                ReportParameter division   = new ReportParameter("Division", _division);
                ReportParameter agent      = new ReportParameter("AgentNumber", _agent);
                ReportParameter region     = new ReportParameter("Region", _region);
                ReportParameter district   = new ReportParameter("District", _district);
                ReportParameter store      = new ReportParameter("StoreNumber", _store);
                ReportParameter start      = new ReportParameter("StartDate", _start);
                ReportParameter end        = new ReportParameter("EndDate", _end);
                report.SetParameters(new ReportParameter[] { client, division, agent, region, district, store, start, end, clientName });

                //Update report rendering with new data
                report.Refresh();
                if (!Master.Viewer.Enabled)
                {
                    Master.Viewer.CurrentPage = 1;
                }
                break;

            case "Data":
                //Set local export report and data source
                report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName));
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName]));
                report.Refresh(); break;

            case "Excel":
                //Create Excel mime-type page
                Response.ClearHeaders();
                Response.Clear();
                Response.Charset = "";
                Response.AddHeader("Content-Disposition", "inline; filename=OnTimeDeliverySummaryByStore.xls");
                Response.ContentType = "application/vnd.ms-excel";      //application/octet-stream";
                System.IO.StringWriter       sw = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
                DataGrid dg = new DataGrid();
                dg.DataSource = ds.Tables[mTBLName];
                dg.DataBind();
                dg.RenderControl(hw);
                Response.Write(sw.ToString());
                Response.End();
                break;
            }
        }
        catch (Exception ex) { Master.ReportError(ex); }
    }
示例#42
0
        public static void Maintenance_OnCommand(CommandEventArgs e)
        {
            try
            {
                if (e.Length == 0)
                {
                    Usage(e);
                }
                else
                {
                    string strParam = e.GetString(0);

                    if (strParam.ToLower().Equals("cancel"))
                    {
                        m_Scheduled = false;
                        if (m_Rebuild)
                        {
                            if (KillRebuild())
                            {
                                e.Mobile.SendMessage("Rebuild.exe canceled succesfully.");
                                Rebuild = false;
                            }
                            else
                            {
                                e.Mobile.SendMessage("Error closeing rebuild.exe!!!");
                            }
                        }
                        m_Countdown           = 5;
                        AutoSave.SavesEnabled = true;
                        e.Mobile.SendMessage("Maintenance has been canceled.");
                        World.Broadcast(0x482, true, "Server maintenance has been canceled.");
                        m_Maintenance.Stop();
                    }
                    else if (strParam.ToLower().Equals("rebuild"))
                    {
                        if (Rebuild)
                        {
                            e.Mobile.SendMessage("The server is already prepareing for a rebuild.");
                        }
                        else
                        {
                            Rebuild               = true;
                            Shutdown              = true;
                            Scheduled             = true;
                            AutoSave.SavesEnabled = false;
                            e.Mobile.SendMessage("You have initiated a server rebuild.");
                            m_Maintenance.Start();

                            if (!StartRebuild(Misc.TestCenter.Enabled))
                            {
                                e.Mobile.SendMessage("Rebuild.exe failed to start, canceling rebuild.");
                                Rebuild   = false;
                                Scheduled = false;
                            }
                        }
                    }
                    else if (strParam.ToLower().Equals("restart") || strParam.ToLower().Equals("shutdown"))
                    {
                        if (m_Scheduled)
                        {
                            e.Mobile.SendMessage("The server is already restarting.");
                        }
                        else
                        {
                            m_Shutdown            = strParam.ToLower().Equals("shutdown") ? true : false;
                            m_Scheduled           = true;
                            m_Countdown           = 5;
                            AutoSave.SavesEnabled = false;
                            e.Mobile.SendMessage("You have initiated server {0}.", m_Shutdown ? "shutdown" : "restart");
                            m_Maintenance.Start();
                        }
                    }
                    else
                    {
                        Usage(e);
                    }
                }
            }
            catch (Exception exc)
            {
                LogHelper.LogException(exc);
                e.Mobile.SendMessage("There was a problem with the [Maintenance command!!  See console log");
                System.Console.WriteLine("Error with [Maintenance!");
                System.Console.WriteLine(exc.Message);
                System.Console.WriteLine(exc.StackTrace);
            }
        }
示例#43
0
    protected void TreeViewCategory_SelectedNodeChanged(object sender, EventArgs e)
    {
        CommandEventArgs CmdEvntArgs = new CommandEventArgs("", (object)TreeViewCategory.SelectedValue.ToString());

        btnEdit_Command(sender, CmdEvntArgs);
    }
 void lbCell_Command(object sender, CommandEventArgs e)
 {
     _strOrder             = e.CommandName;
     ViewState["strOrder"] = _strOrder;
     ShowGrid();
 }
        public static void Password_OnCommand(CommandEventArgs e)
        {
            Mobile  from = e.Mobile;
            Account acct = from.Account as Account;

            if (acct == null)
            {
                return;
            }

            IPAddress[] accessList = acct.LoginIPs;

            if (accessList.Length == 0)
            {
                return;
            }

            NetState ns = from.NetState;

            if (ns == null)
            {
                return;
            }

            if (e.Length == 0)
            {
                from.SendMessage("You must specify the new password.");
                return;
            }
            else if (e.Length == 1)
            {
                from.SendMessage("To prevent potential typing mistakes, you must type the password twice. Use the format:");
                from.SendMessage("Password \"(newPassword)\" \"(repeated)\"");
                return;
            }

            string pass  = e.GetString(0);
            string pass2 = e.GetString(1);

            if (pass != pass2)
            {
                from.SendMessage("The passwords do not match.");
                return;
            }

            bool isSafe = true;

            for (int i = 0; isSafe && i < pass.Length; ++i)
            {
                isSafe = (pass[i] >= 0x20 && pass[i] < 0x80);
            }

            if (!isSafe)
            {
                from.SendMessage("That is not a valid password.");
                return;
            }

            try
            {
                IPAddress ipAddress = ns.Address;

                if (Utility.IPMatchClassC(accessList[0], ipAddress))
                {
                    acct.SetPassword(pass);
                    from.SendMessage("The password to your account has changed.");
                }
                else
                {
                    PageEntry entry = PageQueue.GetEntry(from);

                    if (entry != null)
                    {
                        if (entry.Message.StartsWith("[Automated: Change Password]"))
                        {
                            from.SendMessage("You already have a password change request in the help system queue.");
                        }
                        else
                        {
                            from.SendMessage("Your IP address does not match that which created this account.");
                        }
                    }
                    else if (PageQueue.CheckAllowedToPage(from))
                    {
                        from.SendMessage("Your IP address does not match that which created this account.  A page has been entered into the help system on your behalf.");

                        from.SendLocalizedMessage(501234, "", 0x35);                           /* The next available Counselor/Game Master will respond as soon as possible.
                                                                                                * Please check your Journal for messages every few minutes.
                                                                                                */

                        PageQueue.Enqueue(new PageEntry(from, String.Format("[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0]), PageType.Account));
                    }
                }
            }
            catch
            {
            }
        }
示例#46
0
        protected void Pager_Command(object sender, CommandEventArgs e)
        {
            string commandname            = e.CommandName.ToLower();
            int    firstPageIndex         = 0;
            int    pageIndex              = 0;
            int    currentPageNumber      = 0;
            int    currentFirstPageNumber = 0;

            if (ViewState[UniqueID + "FirstPageIndex"] != null)
            {
                firstPageIndex = (int)ViewState[UniqueID + "FirstPageIndex"];
            }

            int.TryParse(this.lblCurrentPageNumber.Text, out currentPageNumber);
            int.TryParse(this.lblCurrentFirstPageNumber.Text, out currentFirstPageNumber);

            switch (commandname)
            {
            case "first":
                pageIndex = 0;
                break;

            case "previous":
                pageIndex = currentPageNumber;
                if (currentPageNumber > 0)
                {
                    pageIndex = currentPageNumber - 1;
                }
                break;

            case "previous10":
                firstPageIndex = currentFirstPageNumber - ShowPageNumbers > 0 ? currentFirstPageNumber - ShowPageNumbers : 0;
                pageIndex      = (currentFirstPageNumber - 1) > 0 ? currentFirstPageNumber - 1 : 0;

                break;

            case "next10":
                firstPageIndex = currentFirstPageNumber + ShowPageNumbers > TotalPageCounts ? TotalPageCounts - ShowPageNumbers : currentFirstPageNumber + 10;
                pageIndex      = firstPageIndex;
                break;

            case "next":
                pageIndex = currentPageNumber;
                if (currentPageNumber < TotalPageCounts - 1)
                {
                    pageIndex = currentPageNumber + 1;
                }
                break;

            case "last":
                pageIndex      = TotalPageCounts - 1;
                firstPageIndex = TotalPageCounts - ShowPageNumbers;
                if (firstPageIndex < 0)
                {
                    firstPageIndex = 0;
                }
                break;

            default:
                int.TryParse(commandname, out pageIndex);
                break;
            }

            if (pageIndex < firstPageIndex || pageIndex >= firstPageIndex + ShowPageNumbers)
            {
                firstPageIndex = pageIndex;
            }

            ViewState[UniqueID + "FirstPageIndex"] = firstPageIndex;

            SaveCurrentPageIndex(pageIndex);

            //invoke the pagechanged
            PageChanged(pageIndex, currentPageNumber);
        }
        protected void btnVer_Command(object sender, CommandEventArgs e)
        {
            int id = int.Parse(e.CommandArgument.ToString());

            Response.Redirect("productoVistaCliente.aspx?id=" + id);
        }
示例#48
0
 private static void VacarJamesGump_OnCommand(CommandEventArgs e)
 {
     e.Mobile.SendGump(new VacarJamesGump(e.Mobile));
 }
示例#49
0
 public virtual bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
 {
     return(true);
 }
示例#50
0
 protected void btnAgregar_Command(object sender, CommandEventArgs e)
 {
     Response.Redirect("CompraVerificarJuego.aspx");
 }
示例#51
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "AdvancedSearch")
            {
                Response.Redirect(Page.AppRelativeVirtualPath + "?Advanced=1");
            }
            else if (e.CommandName == "BasicSearch")
            {
                Response.Redirect(Page.AppRelativeVirtualPath + "?Advanced=0");
            }
            else if (e.CommandName == "Clear")
            {
                // 12/17/2007 Paul.  Clear the sort order as well.
                CommandEventArgs eSortGrid = new CommandEventArgs("SortGrid", null);
                Command(this, eSortGrid);
                // 12/04/2007 Paul.  Clearing the form is not needed as the redirect will do the same.
                // However, when we start to save the last search view, that is when the clear will be useful.
                ClearForm();
                // 12/09/2007 Paul.  We have to save the cleared form, otherwise the default view will restore settings.
                SaveDefaultView();
                Server.Transfer(Page.AppRelativeVirtualPath + "?Advanced=" + nAdvanced.ToString());
            }
            else if (e.CommandName == "SavedSearch.Save")
            {
                txtSavedSearchName.Text = txtSavedSearchName.Text.Trim();
                if (Sql.IsEmptyString(txtSavedSearchName.Text))
                {
                    lblSavedNameRequired.Visible = true;
                }
                else
                {
                    try
                    {
                        string sXML = GenerateSavedSearch(false);

                        Guid gID = Guid.Empty;
                        SqlProcs.spSAVED_SEARCH_Update(ref gID, Security.USER_ID, txtSavedSearchName.Text, m_sMODULE, sXML, String.Empty);

                        // 12/14/2007 Paul.  The sort may have changed, so send an update event.
                        if (!Sql.IsEmptyString(lstColumns.SelectedValue) && (radSavedSearchASC.Checked || radSavedSearchDESC.Checked))
                        {
                            string[]         arrSort   = new string[] { lstColumns.SelectedValue, (radSavedSearchASC.Checked ? "asc" : "desc") };
                            CommandEventArgs eSortGrid = new CommandEventArgs("SortGrid", arrSort);
                            Command(this, eSortGrid);
                        }
                        RefreshSavedSearches(gID);
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                        lblError.Text = ex.Message;
                    }
                }
            }
            else if (e.CommandName == "SavedSearch.Update")
            {
                try
                {
                    string sXML = GenerateSavedSearch(false);

                    Guid gID = Sql.ToGuid(lstSavedSearches.SelectedItem.Value);
                    SqlProcs.spSAVED_SEARCH_Update(ref gID, Security.USER_ID, txtSavedSearchName.Text, m_sMODULE, sXML, String.Empty);

                    // 12/14/2007 Paul.  The sort may have changed, so send an update event.
                    if (!Sql.IsEmptyString(lstColumns.SelectedValue) && (radSavedSearchASC.Checked || radSavedSearchDESC.Checked))
                    {
                        string[]         arrSort   = new string[] { lstColumns.SelectedValue, (radSavedSearchASC.Checked ? "asc" : "desc") };
                        CommandEventArgs eSortGrid = new CommandEventArgs("SortGrid", arrSort);
                        Command(this, eSortGrid);
                    }
                    RefreshSavedSearches(gID);
                }
                catch (Exception ex)
                {
                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                    lblError.Text = ex.Message;
                }
            }
            else if (e.CommandName == "SavedSearch.Delete")
            {
                try
                {
                    Guid gID = Sql.ToGuid(lstSavedSearches.SelectedItem.Value);
                    SqlProcs.spSAVED_SEARCH_Delete(gID);
                    RefreshSavedSearches(Guid.Empty);
                }
                catch (Exception ex)
                {
                    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                    lblError.Text = ex.Message;
                }
            }
            else if (Command != null)
            {
                Command(this, e);
            }
        }
示例#52
0
    /// <summary>
    /// 删除记录
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void LinkButton2_Command(object sender, CommandEventArgs e)
    {
        int Id = Convert.ToInt32(e.CommandName);

        Response.Redirect("N_XJBAdd.aspx?pagetitle=1&indexId=" + Id + "");
    }
示例#53
0
 private static void ArathanFinishGump_OnCommand(CommandEventArgs e)
 {
     e.Mobile.SendGump(new ArathanFinishGump(e.Mobile));
 }
示例#54
0
 public virtual void Execute(CommandEventArgs e, object obj)
 {
 }
 protected void lnkDownloadReport_Command(object sender, CommandEventArgs e)
 {
     CreateWordDocument(e);
 }
示例#56
0
        public void ApplySavedSearch(string sXML)
        {
            try
            {
                if (!Sql.IsEmptyString(sXML))
                {
                    XmlDocument xml = new XmlDocument();
                    xml.LoadXml(sXML);

                    string sSortColumn = XmlUtil.SelectSingleNode(xml, "SortColumn");
                    string sSortOrder  = XmlUtil.SelectSingleNode(xml, "SortOrder");
                    if (!Sql.IsEmptyString(sSortColumn) && !Sql.IsEmptyString(sSortOrder) && Command != null)
                    {
                        // 12/14/2007 Paul.  The ViewState in the search control is different than the view state on the page or the grid control.
                        // We need to send a command to set the sort fields.
                        string[]         arrSort   = new string[] { sSortColumn, sSortOrder };
                        CommandEventArgs eSortGrid = new CommandEventArgs("SortGrid", arrSort);
                        Command(this, eSortGrid);
                    }
                    string sDefaultSearch = XmlUtil.SelectSingleNode(xml, "DefaultSearch");
                    if (!Sql.IsEmptyString(sDefaultSearch))
                    {
                        try
                        {
                            lstSavedSearches.SelectedValue = sDefaultSearch;
                        }
                        catch
                        {
                        }
                    }

                    XmlNodeList nlSearchFields = xml.DocumentElement.SelectNodes("SearchFields/Field");
                    foreach (XmlNode xField in nlSearchFields)
                    {
                        string sDATA_FIELD = XmlUtil.GetNamedItem(xField, "Name");
                        string sFIELD_TYPE = XmlUtil.GetNamedItem(xField, "Type");
                        if (!Sql.IsEmptyString(sDATA_FIELD))
                        {
                            DynamicControl ctl = new DynamicControl(this, sDATA_FIELD);
                            if (ctl != null)
                            {
                                if (sFIELD_TYPE == "ListBox")
                                {
                                    ListControl lst = FindControl(sDATA_FIELD) as ListControl;
                                    if (lst != null)
                                    {
                                        if (lst is ListBox)
                                        {
                                            XmlNodeList nlValues = xField.SelectNodes("Value");
                                            foreach (XmlNode xValue in nlValues)
                                            {
                                                foreach (ListItem item in lst.Items)
                                                {
                                                    if (item.Value == xValue.InnerText)
                                                    {
                                                        item.Selected = true;
                                                    }
                                                }
                                            }
                                        }
                                        else if (lst is DropDownList)
                                        {
                                            // 12/13/2007 Paul.  DropDownLists must be handled separately to ensure that only one item is selected.
                                            try
                                            {
                                                lst.SelectedValue = xField.InnerText;
                                            }
                                            catch
                                            {
                                            }
                                        }
                                    }
                                }
                                else if (sFIELD_TYPE == "DatePicker")
                                {
                                    DatePicker ctlDate = FindControl(sDATA_FIELD) as DatePicker;
                                    if (ctlDate != null)
                                    {
                                        if (!Sql.IsEmptyString(xField.InnerText))
                                        {
                                            ctlDate.DateText = xField.InnerText;
                                        }
                                    }
                                }
                                else if (sFIELD_TYPE == "DateRange")
                                {
                                    XmlNode xStart = xField.SelectSingleNode("After");
                                    if (xStart != null)
                                    {
                                        DatePicker ctlDateStart = FindControl(sDATA_FIELD + "_AFTER") as DatePicker;
                                        if (ctlDateStart != null)
                                        {
                                            if (!Sql.IsEmptyString(xStart.InnerText))
                                            {
                                                ctlDateStart.DateText = xStart.InnerText;
                                            }
                                        }
                                    }
                                    XmlNode xEnd = xField.SelectSingleNode("Before");
                                    if (xEnd != null)
                                    {
                                        DatePicker ctlDateEnd = FindControl(sDATA_FIELD + "_BEFORE") as DatePicker;
                                        if (ctlDateEnd != null)
                                        {
                                            if (!Sql.IsEmptyString(xEnd.InnerText))
                                            {
                                                ctlDateEnd.DateText = xEnd.InnerText;
                                            }
                                        }
                                    }
                                }
                                else if (sFIELD_TYPE == "CheckBox")
                                {
                                    ctl.Checked = Sql.ToBoolean(xField.InnerText);
                                }
                                else if (sFIELD_TYPE == "TextBox")
                                {
                                    ctl.Text = xField.InnerText;
                                }
                                else if (sFIELD_TYPE == "ChangeButton")
                                {
                                    ctl.Text = xField.InnerText;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
            }
        }
示例#57
0
 //Po wciśnięciu strzałek danej książki przekierowujemy na stronę BookDetails.aspx z odpowiednim id.
 protected void lbBookDetails_Command(object sender, CommandEventArgs e)
 {
     Response.Redirect("BookDetails.aspx?id=" + e.CommandArgument);
 }
        private void CreateWordDocument(CommandEventArgs e)
        {
            var id = int.Parse(e.CommandArgument.ToString());

            using (var context = new ReportContext())
            {
                var entity = context.Reports.Find(id);
                if (entity != null)
                {
                    var             customerId = context.Customers.FirstOrDefault(c => c.Name == entity.Company).ID;
                    Document        document   = new Document(Server.MapPath("~/template_files/week_report.doc"));
                    DocumentBuilder docBuilder = new DocumentBuilder(document);
                    document.Range.Replace("{Company}", entity.Company, false, false);
                    document.Range.Replace("{ReportType}", new ManageReports().GetTypeNameById(entity.ReportType.ToInt32()), false, false);
                    document.Range.Replace("{year}", entity.Year.Trim(), false, false);
                    document.Range.Replace("{month}", entity.Month.Trim(), false, false);
                    document.Range.Replace("{Subsidiary}", entity.Subsidiary ?? "", false, false);
                    document.Range.Replace("{area}", entity.Area ?? "", false, false);
                    document.Range.Replace("{day}", entity.Day.Trim(), false, false);
                    document.Range.Replace("{number1}", entity.CurrentNumber.Trim(), false, false);
                    document.Range.Replace("{number2}", entity.TotalNumber.Trim(), false, false);
                    document.Range.Replace("{TypeString}", CommonUtility.ReplaceReportType(new ManageReports().GetTypeNameById(entity.ReportType.ToInt32())), false, false);
                    document.Range.Replace("{aTypeString}", CommonUtility.ReplaceReportType(new ManageReports().GetTypeNameById(entity.ReportType.ToInt32())).Replace("本", ""), false, false);

                    document.Range.Replace("{news_number}", entity.News_number.ToString(), false, false);
                    document.Range.Replace("{hudong_number}", entity.Hudong_number.ToString(), false, false);
                    document.Range.Replace("{mingan_number}", entity.Mingan_number.ToString(), false, false);
                    document.Range.Replace("{strText}", entity.StrText, false, false);
                    document.Range.Replace(new Regex("{info_total_pic}"), new ReplaceAndInsertImage(Server.MapPath(entity.Info_total_pic)), false);
                    //本周重点敏感舆情、风险分析研判与处置建议
                    if (!string.IsNullOrEmpty(entity.PriorityArticles))
                    {
                        var articleIds = entity.PriorityArticles.Split(',').Select(a => int.Parse(a));
                        var entities   = context.Articles.Where(a => a.CustomerID == customerId && articleIds.Contains(a.ID)).OrderByDescending(a => a.ID).Select(a => a);
                        int i          = 0;
                        docBuilder.MoveToMergeField("Content");
                        foreach (var article in entities)
                        {
                            i++;
                            //插入标题
                            docBuilder.Writeln();
                            docBuilder.Font.Name = "楷体_GB2312";
                            docBuilder.Font.Size = 16;
                            docBuilder.Font.Bold = true;
                            docBuilder.Writeln(String.Format("{0}.{1}", i, article.Title));
                            docBuilder.Font.ClearFormatting();

                            //插入内容
                            docBuilder.Font.Size = 16;
                            docBuilder.Font.Name = "仿宋_GB2312";
                            docBuilder.Writeln(article.Content);
                            docBuilder.Font.ClearFormatting();

                            //插入图片
                            if (!string.IsNullOrEmpty(article.ScreenshotsPath))
                            {
                                FileInfo fileInfo = new FileInfo(Server.MapPath(article.ScreenshotsPath));
                                if (fileInfo.Exists)
                                {
                                    docBuilder.InsertImage(Server.MapPath(article.ScreenshotsPath), RelativeHorizontalPosition.Margin, 1, RelativeVerticalPosition.Default, 10, 430, 220, WrapType.Square);
                                }
                            }

                            //插入链接
                            docBuilder.Font.Size = 16;
                            docBuilder.Font.Name = "仿宋_GB2312";
                            docBuilder.Write("网址链接:");
                            docBuilder.Font.ClearFormatting();

                            docBuilder.Font.Color     = Color.Blue;
                            docBuilder.Font.Size      = 10;
                            docBuilder.Font.Name      = "仿宋";
                            docBuilder.Font.Underline = Underline.Single;
                            docBuilder.InsertHyperlink(article.Url, article.Url, false);
                            docBuilder.Font.ClearFormatting();

                            docBuilder.Font.Name = "仿宋_GB2312";
                            docBuilder.Font.Size = 16;
                            docBuilder.Writeln();
                            docBuilder.Writeln(String.Format("风险分析研判:{0}", article.JudgeContent));
                            docBuilder.Write("舆情星级:");
                            docBuilder.Font.ClearFormatting();

                            //插入舆情星级
                            docBuilder.Font.Name  = "仿宋_GB2312";
                            docBuilder.Font.Size  = 16;
                            docBuilder.Font.Color = Color.Red;
                            docBuilder.Writeln("★".Repeat(article.Rating.Value));
                            docBuilder.Font.ClearFormatting();

                            //插入处置建议
                            docBuilder.Font.Name = "仿宋_GB2312";
                            docBuilder.Font.Size = 16;
                            docBuilder.Write(String.Format("处置建议:{0}", article.SuggestContent));;
                            docBuilder.Font.ClearFormatting();
                        }
                    }

                    docBuilder.MoveToMergeField("DistributeContent");
                    docBuilder.Write(entity.DistributeSummary.Replace("#", ""));
                    if (!string.IsNullOrEmpty(entity.Distribute_Pic))
                    {
                        docBuilder.InsertImage(Server.MapPath(entity.Distribute_Pic), RelativeHorizontalPosition.Margin, 1, RelativeVerticalPosition.Default, 10, 430, 220, WrapType.Square);
                    }

                    document.Range.Replace(new Regex("{NextWeekWarning_Pic}"), new ReplaceAndInsertImage(Server.MapPath(entity.NextWeekWarning_Pic)), false);
                    document.Range.Replace("{NextWeekMinganValue}", entity.NextWeekMinganValue, false, false);
                    document.Range.Replace("{NextWeekSustainNumber}", entity.NextWeekSustainNumber.Value.ToString(), false, false);
                    docBuilder.MoveToMergeField("Questions");
                    int b = 0;
                    docBuilder.Writeln();
                    foreach (var item in entity.AttentionQuestions.Split('|'))
                    {
                        b++;
                        if (item.Split(',')[0] != item.Split(',')[1])
                        {
                            string str = String.Format("{0}.{1}", b, item.Split(',')[0]);
                            docBuilder.Font.Size = 16;
                            docBuilder.Font.Name = "仿宋_GB2312";
                            docBuilder.Font.Bold = true;
                            docBuilder.Writeln(str);
                            docBuilder.Font.ClearFormatting();
                            if (b == entity.AttentionQuestions.Split('|').Count())
                            {
                                docBuilder.Font.Size = 16;
                                docBuilder.Font.Name = "仿宋_GB2312";
                                docBuilder.Write(item.Split(',')[1].Trim());
                                docBuilder.Font.ClearFormatting();
                            }
                            else
                            {
                                docBuilder.Font.Size = 16;
                                docBuilder.Font.Name = "仿宋_GB2312";
                                docBuilder.Writeln(item.Split(',')[1].Trim());
                                docBuilder.Font.ClearFormatting();
                            }
                        }
                        else
                        {
                            if (b == entity.AttentionQuestions.Split('|').Count())
                            {
                                docBuilder.Font.Size = 16;
                                docBuilder.Font.Name = "仿宋_GB2312";
                                docBuilder.Write(String.Format("{0}.{1}", b, item.Split(',')[1]));
                                docBuilder.Font.ClearFormatting();
                            }
                            else
                            {
                                docBuilder.Font.Size = 16;
                                docBuilder.Font.Name = "仿宋_GB2312";
                                docBuilder.Writeln(String.Format("{0}.{1}", b, item.Split(',')[1]));
                                docBuilder.Font.ClearFormatting();
                            }
                        }
                    }

                    document.Range.Replace(new Regex("{week_pic}"), new ReplaceAndInsertImage(Server.MapPath(entity.Week_Pic)), false);
                    document.Range.Replace("{lowExponent}", entity.LowExponent.ToString(), false, false);
                    document.Range.Replace("{heightExponent}", entity.HeightExponent.Value.ToString(), false, false);
                    document.Range.Replace("{avgExponent}", entity.AvgExponent.Value.ToString(), false, false);
                    document.Range.Replace("{startMonth}", entity.StartMonth.Value.ToString(), false, false);
                    document.Range.Replace("{startDay}", entity.StartDay.Value.ToString(), false, false);
                    document.Range.Replace("{lowNumber}", entity.LowNumber.Value.ToString(), false, false);
                    document.Range.Replace("{endMonth}", entity.EndMonth.Value.ToString(), false, false);
                    document.Range.Replace("{endDay}", entity.EndDay.Value.ToString(), false, false);
                    document.Range.Replace("{heightNumber}", entity.HeightNumber.Value.ToString(), false, false);
                    document.Range.Replace("{trend}", entity.Tend, false, false);



                    document.Range.Replace(new Regex("{attention_pic}"), new ReplaceAndInsertImage(Server.MapPath(entity.Attention_Picture)), false);
                    document.Range.Replace("{total_AttentionNumber}", entity.Total_AttentionNumber.Value.ToString(), false, false);
                    document.Range.Replace("{mobile_AttentNumber}", entity.Mobile_AttentNumber.Value.ToString(), false, false);
                    document.Range.Replace("{total_FloatingType}", entity.Total_FloatingType, false, false);
                    document.Range.Replace("{total_AttentionPercent}", entity.Total_AttentionPercent, false, false);
                    document.Range.Replace("{mobile_FloatingType}", entity.Mobile_FloatingType, false, false);
                    document.Range.Replace("{mobile_AttentionPercent}", entity.Mobile_AttentionPercent, false, false);
                    StringBuilder cityBuilder = new StringBuilder();
                    foreach (var item in entity.AttentionCities.Split("、"))
                    {
                        cityBuilder.AppendFormat("{0}、", item);
                    }
                    string cities = cityBuilder.ToString().TrimEnd('、');
                    document.Range.Replace("{cities}", cities, false, false);


                    string fileName = String.Format("{0}网络舆情{1}第{2}期.doc", entity.Company, new ManageReports().GetTypeNameById(entity.ReportType.ToInt32()), entity.CurrentNumber);

                    //string fileName = String.Format("{0}网络舆情{1}第{2}期.doc", entity.Company, "aaaaaaa", entity.CurrentNumber);
                    using (MemoryStream ms = new MemoryStream())
                    {
                        document.Save(ms, Aspose.Words.Saving.SaveOptions.CreateSaveOptions(SaveFormat.Doc));
                        Response.ContentType = "application/msword";
                        Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
                        Response.BinaryWrite(ms.ToArray());
                        Response.End();
                    }
                }
            }
        }
示例#59
0
 protected void bookdetail_Command(object sender, CommandEventArgs e)
 {
     Session["selectedBook"] = e.CommandArgument.ToString();
     Response.Redirect("ItemDetail.aspx");
 }
示例#60
0
        protected void btnPagar_Command(object sender, CommandEventArgs e)
        {
            if (Session["usuario"] == null)
            {
                Response.Redirect("inicioSesion.aspx");
            }
            else
            {
                //Usuario autentificado
                UsuarioEntidad user = (UsuarioEntidad)Session["usuario"];


                CompraEntidad compra = new CompraEntidad();
                compra.fecha     = DateTime.Now;
                compra.idUsuario = user.idUsuario;

                //Datos producto
                double descuento  = 0;
                double totalPagar = 0;
                foreach (var item in listaCarrito)
                {
                    compra.idProducto        = item.idProducto;
                    compra.cantidadProductos = item.cantidadProductos;
                    totalPagar = Convert.ToDouble(item.total);
                }



                //Consultar cupon por usuario
                List <CuponEntidad> cupones = new List <CuponEntidad>();
                cupones = CuponLN.ObtenerCuponporUsuario(user.idUsuario);
                foreach (var item in cupones)
                {
                    if (item.idNivel == user.nivelEntidad.idNivel && item.idProducto == compra.idProducto)
                    {
                        NivelEntidad nivel = NivelLN.Obtener(item.idNivel);
                        if (nivel.descripcion == "Bronce")
                        {
                            compra.total = Convert.ToDecimal(totalPagar - (totalPagar * 0.02));
                            descuento    = totalPagar * 0.02;
                        }
                        else
                        {
                            if (nivel.descripcion == "Plata")
                            {
                                compra.total = Convert.ToDecimal(totalPagar - (totalPagar * 0.05));
                                descuento    = totalPagar * 0.05;
                            }
                            else
                            {
                                if (nivel.descripcion == "Oro")
                                {
                                    compra.total = Convert.ToDecimal(totalPagar - (totalPagar * 0.07));
                                    descuento    = totalPagar * 0.07;
                                }
                                else
                                {
                                    if (nivel.descripcion == "Diamante")
                                    {
                                        compra.total = Convert.ToDecimal(totalPagar - (totalPagar * 0.10));
                                        descuento    = totalPagar * 0.10;
                                    }
                                    else
                                    {
                                        compra.total = Convert.ToDecimal(totalPagar);
                                    }
                                }
                            }
                        }
                    }
                }


                if (compra != null)
                {
                    if (compra.total == 0)
                    {
                        compra.total = Convert.ToDecimal(totalPagar);
                    }

                    CompraLN.Nuevo(compra);
                    CompraLN.limpiarLista();
                    descuentoGlobal = 0;
                    totalFinal      = 0;
                    Response.Redirect("carritoCompras.aspx");
                    this.lblMensaje.Text = "Compra realizada con exito";
                }
            }
        }