Exemple #1
0
        protected void SignButton_Click(object sender, EventArgs e)
        {
            string firstname = TextBox1.Text;
            string lastname  = TextBox2.Text;
            string username  = TextBox3.Text;
            string password  = TextBox4.Text;

            string loc1      = DropDownList1.SelectedValue;
            int    location1 = int.Parse(loc1);

            string loc2      = DropDownList2.SelectedValue;
            int    location2 = int.Parse(loc2);


            string address = TextBox6.Text;
            string contact = TextBox7.Text;
            string join    = TextBox8.Text;
            string salary  = TextBox9.Text;

            if (password != TextBox6.Text)
            {
                DebugLabel.Text = "Input Password Carefully!";
            }


            string query1 = "SELECT MAX(\"agent_id\") AS aid FROM DELIVERY_AGENT";

            AgentProtocol.SelectCommand     = query1;
            AgentProtocol.SelectCommandType = SqlDataSourceCommandType.Text;
            DataView dv = AgentProtocol.Select(DataSourceSelectArguments.Empty) as DataView;


            int id = 0;

            id  = Convert.ToInt32(dv.Table.Rows[0][0]);
            id += 1;

            string insQ = "INSERT INTO DELIVERY_AGENT VALUES (" + id + ",'" +
                          firstname + "','" + lastname + "','" + username + "','" + password + "'," + loc1 + "," + loc2
                          + ",'" + address + "'," + contact + ",'" + join + "'," + salary + ",0)";

            DebugLabel.Text = insQ;



            AgentProtocol.InsertCommand     = insQ;
            AgentProtocol.InsertCommandType = SqlDataSourceCommandType.Text;
            int nrows = AgentProtocol.Insert();

            if (nrows > 0)
            {
                DebugLabel.Text = "Insertion successful";
            }
            else
            {
                DebugLabel.Text = "Insertion failed. Please try again.";
            }
        }
 public void StartAgentLogic(Action<object, string> onStarted)
 {
     var agent = new AgentProtocol();
     Agent = agent;
     Agent.OnMailing = this.OnMailing;
     Agent.OnDelayedMailing = this.OnDelayedMailing;
     Agent.OnPausedMailing = this.OnPausedMailing;
     Agent.StartAgentLogic(onStarted);
 }
        private void PerformStop(AgentProtocol agent)
        {
            try
            {
                agent.StopAgentLogic();
            }
            catch (Exception ex)
            {

                //this.LogInfo("TMailAgent Failed to Stop : {0}",ex.Message);
                //this.TraceData(TraceEventType.Error, "Unexpected Error In PerformStart", ex.FormatForLogging());
                YPMon.Critical("TMailAgentService", "Unexpected Error In PerformStop", ex.FormatForLogging());
                throw;
            }
        }