예제 #1
0
        protected void on_row(object sender, GridViewCommandEventArgs e)
        {
            string path = Server.MapPath("../UploadDocs") + "\\";

            if (e.CommandName == "View")
            {
                int        rowindex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                LinkButton lbtn     = (LinkButton)grdClientDocs.Rows[rowindex].FindControl("btnView");
                string     docid    = ((Label)grdClientDocs.Rows[rowindex].FindControl("lblID")).Text;
                string     clientid = ((Label)grdClientDocs.Rows[rowindex].FindControl("lblClientID")).Text;
                string     filename = ((Label)grdClientDocs.Rows[rowindex].FindControl("lblFileName")).Text;

                string filepath = path + clientid + "\\" + filename;
                if (!File.Exists(filepath))
                {
                    Tell.text("File Not Exist", this);
                    return;
                }
                else
                {
                    System.IO.FileInfo file = new System.IO.FileInfo(filepath);

                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                    Response.AddHeader("Content-Length", file.Length.ToString());
                    Response.ContentType = "application/octet-stream";
                    Response.WriteFile(file.FullName);
                    Response.End();
                }
            }
        }
예제 #2
0
        private async void ClientStartButton(object sender, RoutedEventArgs e)
        {
            if (!ClientHost.isConnected)
            {
                ClientHost.registrationDone.Reset();
                await Task.Run(() => ClientHost.StartClient());
            }

            if (ClientHost.isConnected)
            {
                _Status.Content    = "Connected";
                _Status.Foreground = Brushes.Orange;

                Tell.Stop();
            }

            if (!ClientHost.isRegistred && ClientHost.isConnected)
            {
                Packet toSend = new Packet(Packet.Packettype.Registration);
                toSend.Data.Add(InputNick.Text);
                ClientHost.Send(toSend);
                ClientHost.registrationDone.WaitOne();
            }

            if (ClientHost.isRegistred && ClientHost.isConnected)
            {
                _Status.Content       = "Registered";
                _Status.Foreground    = Brushes.Green;
                _InputNick.IsEnabled  = false;
                _Input.IsEnabled      = true;
                _ServerList.IsEnabled = false;
                _Refresh.IsEnabled    = false;
                _Start.IsEnabled      = false;
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.Write("Enter first variable -> ");
            int firstV = int.Parse(Console.ReadLine());

            Console.Write("Enter second variable -> ");
            int secondV = Int32.Parse(Console.ReadLine());

            Console.Write("Enter third variable -> ");
            int thirdV = Int32.Parse(Console.ReadLine());

            var operations = new ArithmeticOperations();

            operations.Average(firstV, secondV, thirdV);

            Console.WriteLine(operations.Sum(firstV, secondV, thirdV));
            Console.WriteLine(operations.Average(firstV, secondV, thirdV));

            var tell = new Tell();

            Console.WriteLine("What is your name?");

            var name = Console.ReadLine();

            tell.Greeting(name);
        }
예제 #4
0
 public double Substract(double a, double b)
 {
     if (a - b == 0)
     {
         Tell?.Invoke("Result is 0");
         return(0);
     }
     else
     {
         return(a - b);
     }
 }
예제 #5
0
 public double Multiplicate(double a, double b)
 {
     if (a * b == 0)
     {
         Tell?.Invoke("Result is 0");
         return(0);
     }
     else
     {
         return(a * b);
     }
 }
예제 #6
0
        public static void ResetStatus()
        {
            _Status.Content       = "Disconnected";
            _Status.Foreground    = Brushes.Red;
            _InputNick.IsEnabled  = true;
            _Input.IsEnabled      = false;
            _Start.IsEnabled      = true;
            _ServerList.IsEnabled = true;
            _Refresh.IsEnabled    = true;

            Tell.Start();
        }
예제 #7
0
 public double Divide(double a, double b)
 {
     if (a / b == 0)
     {
         Tell?.Invoke("Result is 0");
         return(0);
     }
     else
     {
         return(a / b);
     }
 }
예제 #8
0
 public double Add(double a, double b)
 {
     if (a + b == 0)
     {
         Tell.Invoke("Result is 0");
         return(0);
     }
     else
     {
         return(a + b);
     }
 }
예제 #9
0
 protected void grdScheduled_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Mark")
     {
         int              rowindex = ((GridViewRow)((Button)e.CommandSource).NamingContainer).RowIndex;
         Button           lbtn     = (Button)grdScheduled.Rows[rowindex].FindControl("btnMark");
         Int32            ID       = Convert.ToInt32(((Label)grdScheduled.Rows[rowindex].FindControl("lblID")).Text);
         DashboardManager obj      = new DashboardManager();
         Int32            j        = obj.UpdateDashoard(ID, "INOFFICE", "");
         binddata();
         Tell.text("Client marked as in office!!", this);
     }
 }
예제 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["PatientID"] == null || Session["PatientID"].ToString().Equals("0"))
         {
             Tell.error("Patient Id not found", this);
         }
         else
         {
             gridBind();
         }
     }
 }
예제 #11
0
        public bool AddTell(string fromUser, string toUser, string message)
        {
            var newTell = new Tell()
            {
                Author    = fromUser,
                Recipient = toUser,
                Message   = message,
                Timestamp = DateTime.UtcNow
            };

            _Db.Tell.Add(newTell);
            var numChanges = _Db.SaveChanges();

            return(numChanges > 0);
        }
예제 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Toolkit1.RegisterAsyncPostBackControl(btnFollowupQuestionsSave);
     if (!IsPostBack)
     {
         if (Session["PatientID"] == null || Convert.ToString(Session["PatientID"]).Equals("0"))
         {
             Tell.Alert("Info", "Patient Id not found!!", this);
         }
         else
         {
             bind();
         }
         gridBind();
     }
 }
예제 #13
0
        public void OnLoad()
        {
            PanelSetUp();
            _BubbelBox              = ChatContainer;
            _Status                 = StatusLabel;
            _Input                  = Input;
            _Input.IsEnabled        = false;
            _InputNick              = InputNick;
            _Start                  = Start;
            _ServerList             = ServerList;
            _Notifications          = NotificationsBox;
            _ServerList.ItemsSource = Tell.serverDynamicList;
            _Refresh                = RefreshButton;

            Tell.Start();
        }
예제 #14
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string filepath = Server.MapPath("../UploadDocs") + "\\" + Session["PatientID"].ToString();

            if (!FileUpload1.HasFile)
            {
                Tell.error("Select the file", this);
                return;
            }
            if (File.Exists(filepath + "\\" + FileUpload1.PostedFile.FileName))
            {
                Tell.error("File already exist", this);
                return;
            }

            if (Session["PatientID"] == null || Session["PatientID"].ToString().Equals("0"))
            {
                Tell.text("Patient Id not found", this);
            }
            else
            {
                if (!Directory.Exists(filepath))
                {
                    Directory.CreateDirectory(filepath);
                }

                cmd = new SqlCommand("Insert into ClientDocument Values(@patientid,@clientname,@description,@filename,0,dateadd(minute,330,getutcdate()))", con);
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@patientid", Session["PatientID"].ToString());
                cmd.Parameters.AddWithValue("@clientname", txtName.Text);
                cmd.Parameters.AddWithValue("@description", txtDescription.Text);
                cmd.Parameters.AddWithValue("@filename", FileUpload1.PostedFile.FileName);
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                cmd.ExecuteNonQuery();
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                FileUpload1.SaveAs(filepath + "\\" + FileUpload1.PostedFile.FileName);
                gridBind();
                Tell.Alert("Info", "Data Added succesfully", this);
            }
        }
예제 #15
0
    protected void on_row(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "View")
        {
            int        rowindex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
            LinkButton lbtn     = (LinkButton)grdPatients.Rows[rowindex].FindControl("btnView");
            Toolkit1.RegisterPostBackControl(lbtn);
            string value = ((Label)grdPatients.Rows[rowindex].FindControl("lblID")).Text;
            Session["PatientID"] = value;
            Session["Operation"] = "Edit";
            Server.Transfer("~/Screens/PatientMaster.aspx");
        }
        if (e.CommandName == "Visit")
        {
            int        rowindex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
            LinkButton lbtn     = (LinkButton)grdPatients.Rows[rowindex].FindControl("btnVisit");
            Toolkit1.RegisterPostBackControl(lbtn);
            string value = ((Label)grdPatients.Rows[rowindex].FindControl("lblID")).Text;
            Session["PatientID"] = value;
            master = new DietMasterManager();

            Int32 i = master.UpdateClientData(Convert.ToInt16(Session["PatientID"].ToString()));
            if (i == 1)
            {
                Tell.text("Marked as visit successfully!!", this);
            }
            else if (i == -1)
            {
                Tell.text("Visit already marked today!!", this);
            }
            else
            {
                Tell.text("Visit not marked !!", this);
            }

            dtSearchMaster         = master.SearchPatients("", "ALL", Convert.ToString(Session["UserCode"]));
            grdPatients.DataSource = dtSearchMaster;
            grdPatients.DataBind();
        }
    }
예제 #16
0
        public bool Parse(string[] args)
        {
            var p = new Params(args);

            if (p.Default("-n", out Iterations, 30).IsInvalid())
            {
                return(false);
            }
            if (p.Default("-l", out Lambda, 1.0).IsInvalid())
            {
                return(false);
            }
            if (p.Default("-o", out Dst).IsBad())
            {
                Dst = Aids.GetOutputName(Which);
            }
            SrcArr = p.Remaining();
            if (SrcArr.Length < 1)
            {
                Tell.MustProvideInput("one or more input images");
                return(false);
            }
            return(true);
        }
예제 #17
0
        /// <summary>
        /// The parse.
        /// </summary>
        /// <param name="client">
        /// </param>
        /// <param name="packet">
        /// </param>
        /// <param name="messageNumber">
        /// </param>
        /// <returns>
        /// </returns>
        public bool Parse(Client client, byte[] packet, ushort messageNumber)
        {
            switch (messageNumber)
            {
            case 0:
                Authenticate.Read(client, ref packet);
                break;

            case 2:

                // Chat bot wants to authenticate
                AuthenticateBot.Read(client, packet);
                break;

            case 3:
                LoginCharacter.Read(client, packet);
                break;

            case 21:
                PlayerNameLookup.Read(client, packet);
                break;

            case 30:
                Tell.Read(client, packet);
                break;

            case 40:
                BuddyAdd.Read(client, packet);
                break;

            case 41:
                new BuddyRemove().Read(client, packet);
                break;

            case 42:
                new OnlineStatus().Read(client, packet);
                break;

            case 50:
                new PrivateGroupInvitePlayer().Read(client, packet);
                break;

            case 51:
                new PrivateGroupKickPlayer().Read(client, packet);
                break;

            case 52:
                new PrivateGroupJoin().Read(client, packet);
                break;

            case 53:
                new PrivateGroupLeave().Read(client, packet);
                break;

            case 54:

                // this packet should have no data to read
                PrivateGroupKickEveryone.Read(client, ref packet);
                break;

            case 57:
                new PrivateGroupMessage().Read(client, packet);
                break;

            case 64:
                new ChannelDataSet().Read(client, packet);
                break;

            case 65:
                ChannelMessage.Read(client, packet);
                break;

            case 66:
                new ChannelMode().Read(client, packet);
                break;

            case 70:
            case 71:

                // should never get these messages (ClimodeGet and ClimodeSet)
                break;

            case 100:

                // Ping
                client.Send(packet);
                break;

            case 110:
                break;

            case 120:
                new ChatCommand().Read(client, packet);
                break;

            default:
                client.Server.Warning(client, "Client sent unknown message {0}", messageNumber.ToString());
                return(false);
            }

            return(true);
        }
예제 #18
0
	public void Start() 
    {
	    instance = this;    
	}
예제 #19
0
 private void TellSubscription_Matched(object sender, Tell e)
 {
     OnTell?.Invoke(sender, e);
 }
예제 #20
0
        public static CharacterInstance GetShopkeep(CharacterInstance ch, IGameManager gameManager = null)
        {
            var keeper =
                ch.CurrentRoom.Persons.OfType <MobileInstance>()
                .FirstOrDefault(mob => mob.IsNpc() && mob.MobIndex.Shop != null);

            if (CheckFunctions.CheckIfNullObject(ch, keeper, "You can't do that here."))
            {
                return(null);
            }
            if (DoesKeeperHateKillers(keeper, ch))
            {
                return(null);
            }
            if (DoesKeeperHateThieves(keeper, ch))
            {
                return(null);
            }
            if (DoesKeeperHateFighting(keeper, ch))
            {
                return(null);
            }
            if (IsKeeperFighting(keeper, ch))
            {
                return(null);
            }
            if (IsShopClosed(keeper, ch, (gameManager ?? GameManager.Instance).GameTime.Hour))
            {
                return(null);
            }
            if (CheckFunctions.CheckIfTrue(ch, keeper.CurrentPosition == PositionTypes.Sleeping,
                                           "While they're asleep?"))
            {
                return(null);
            }
            if (CheckFunctions.CheckIfTrue(ch, (int)keeper.CurrentPosition < (int)PositionTypes.Sleeping,
                                           "I don't think they can hear you..."))
            {
                return(null);
            }
            if (IsVisibleToKeeper(keeper, ch))
            {
                return(null);
            }

            var speakswell = keeper.KnowsLanguage(ch.Speaking, ch).GetLowestOfTwoNumbers(ch.KnowsLanguage(ch.Speaking, keeper));

            if (SmaugRandom.D100() % 65 > speakswell)
            {
                string buffer;
                if (speakswell > 60)
                {
                    buffer = $"{ch.Name} Could you repeat that?  I didn't quite catch it.";
                }
                else if (speakswell > 50)
                {
                    buffer = $"{ch.Name} Could you say that a little more clearly please?";
                }
                else if (speakswell > 40)
                {
                    buffer = $"{ch.Name} Sorry... What was that you wanted?";
                }
                else
                {
                    buffer = $"{ch.Name} I can't understand you.";
                }

                Tell.do_tell(keeper, buffer);
                return(null);
            }

            return(keeper);
        }