Exemple #1
0
        public int Update(KISModel model)
        {
            string sql = string.Format("update KISData set AccountName='{0}',InvoiceFrom='{1}',InvoiceTo='{2}',PayableTo='{3}'," +
                                       "PayableFrom='{4}',InvoiceDate='{5}',PayableDate='{6}',IP='{7}',UserID='{8}',Pwd='{9}'", model.AccountName,
                                       model.InvoiceFrom, model.InvoiceTo, model.PayableTo, model.PayableFrom, model.InvoiceDate, model.PayableDate, model.IP, model.UserID, model.Pwd);

            using (SqlConnection conn = new SqlConnection(DBConn))
            {
                conn.Open();
                SqlCommand objCommand = new SqlCommand(sql, conn);
                objCommand.ExecuteNonQuery();
                conn.Close();
            }
            return(1);
        }
Exemple #2
0
        public KISModel ReaderBind(IDataReader dataReader)
        {
            KISModel model = new KISModel();

            model.AccountName = dataReader["AccountName"].ToString();
            model.InvoiceFrom = dataReader["InvoiceFrom"].ToString();
            model.InvoiceTo   = dataReader["InvoiceTo"].ToString();
            model.PayableFrom = dataReader["PayableFrom"].ToString();
            model.PayableTo   = dataReader["PayableTo"].ToString();
            model.InvoiceDate = dataReader["InvoiceDate"].ToString();
            model.PayableDate = dataReader["PayableDate"].ToString();
            model.Message     = dataReader["Message"].ToString();
            model.IP          = dataReader["IP"].ToString();
            model.UserID      = dataReader["UserID"].ToString();
            model.Pwd         = dataReader["Pwd"].ToString();
            return(model);
        }
Exemple #3
0
        public KISModel GetKIS()
        {
            var    kis = new KISModel();
            string sql = "select * from KISData;";

            using (SqlConnection conn = new SqlConnection(DBConn))
            {
                conn.Open();
                SqlCommand objCommand = new SqlCommand(sql, conn);
                using (SqlDataReader objReader = objCommand.ExecuteReader())
                {
                    if (objReader.Read())
                    {
                        kis = ReaderBind(objReader);
                    }
                    objReader.Close();
                }
                conn.Close();
            }
            return(kis);
        }