using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Globalization;

namespace CheckSheet
{
    public partial class Setup : System.Web.UI.Page
    {


        [System.Web.Services.WebMethod]
        public static string save(string docno,string hostip,string smtp,string email,string password,string port)
        {
            string cmd = string.Empty;
            //string strEncriptPassword = clsControlUI.encriptpassword(email, password);

            using(FcSql.Function fc = new FcSql.Function())
            {

                string str_config = string.Format("update mst_Config set iphost='{0}', smtp='{1}', email='{2}', password='{3}', port='{4}' Where id=1 ", hostip, smtp, email, password, port);
                cmd = fc.ExecSQLStatement(str_config);

                fc.closeconnection();

            }

            return cmd;


        }

        [System.Web.Services.WebMethod]
        public static string getdata()
        {


            //string docno = clsControlUI.GetXML("docno");
            //string hostip = clsControlUI.GetXML("hostip");
            //string smtp = clsControlUI.GetXML("smtp");
            //string email = clsControlUI.GetXML("email");
            //string password = clsControlUI.GetXML("password");
            //string port = clsControlUI.GetXML("port");

            //string strDecriptPassword = clsControlUI.decriptpassword(email, password);
            string valueconfig = string.Empty;
            using (FcSql.Function fc = new FcSql.Function())
            {
                string str_config = string.Format("select id, iphost, smtp, email, password, port from mst_Config Where id=1");
                DataTable dt = fc.SQL_DataTable(str_config);
                if (dt.Rows.Count > 0)
                {
                    valueconfig = "|"+dt.Rows[0]["iphost"].ToString() + '|' + dt.Rows[0]["smtp"].ToString() + '|' + dt.Rows[0]["email"].ToString() + '|' + dt.Rows[0]["password"].ToString() + '|' + dt.Rows[0]["port"].ToString();
                }



            }

            return valueconfig;


        }


        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnback_Click(object sender, EventArgs e)
        {
            Response.Redirect("Menusetting");
        }
    }
}