View Single Post
 
Old 11-05-2017, 02:50 PM
kuba15 kuba15 is offline
Newcomer
 
Join Date: Nov 2017
Location: Berlin, Germany
Posts: 1
Default Asp.net: using Console application call Web-form application's method

I am trying to make web form asp.net application to windows service. I got a tutorial there console application used to convert exe file, then it is used as a windows service. That is run in starting of windows and do continue. I need web form (aspx, cs files used) page convert to service what will run in starting of windows. or any way to make cron-job of web form page where used timer,

Code:
aspx::
    <asp:Timer ID="Timer1" runat="server" Interval="" ontick="Timer1_Tick">
             </asp:Timer>
cs::
  public void CallMethod()//-------------------3
        {
            conCondition.GetConnectedConn();//con test from diff class
            CopyLocalDir();
            InsertAtmLogToDB();
            ParsedDataInsert();//
        }

        protected void Timer1_Tick(object sender, EventArgs e)//Ontick method-------defined in input----2
        {
            CallMethod();
        }

        public void getInterval()/// Called in page load-----to call::: Timer1_Tick-----------1
        {
            string selectTime = "select time from timer";
            con.Open();
            SqlCommand select = new SqlCommand(selectTime, con);
            SqlDataReader sdr = select.ExecuteReader();

            int setTime = 0;
            if (sdr.Read())
            {
                setTime = int.Parse(sdr["time"].ToString());
            }
            con.Close();
            Timer1.Interval = setTime;//set time to id(named Timer1) of input field(of aspx file)
        }
Reply With Quote