예제 #1
0
        public List <Model_visit_client> DataTableToList(DataTable dt)
        {
            List <Model_visit_client> list = new List <Model_visit_client>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_visit_client item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string iid         = Request["iid"].Filter();
            string tabid       = Request["TabId"].Filter();
            string UserId      = Request["UserId"].Filter();
            string productType = Request["ProductType"].Filter();

            if (!IsPostBack)
            {
                DataTable dt     = new DataTable();
                string    strSql = string.Empty;
                strSql = @"select A.Book_ID,A.Resource_Url,A.File_Suffix,A.Resource_Name from ResourceToResourceFolder A 
 where ResourceToResourceFolder_Id='" + iid.Filter() + "' ";
                dt     = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                if (dt.Rows.Count == 1)
                {
                    #region 记录教案访问情况
                    Model_visit_client modelVC = new Model_visit_client();
                    modelVC.visit_client_id  = Guid.NewGuid().ToString();
                    modelVC.user_id          = UserId;
                    modelVC.resource_data_id = iid;
                    modelVC.product_type     = productType;
                    modelVC.tab_id           = tabid;
                    modelVC.open_time        = DateTime.Now;
                    modelVC.operate_type     = "view";
                    new BLL_visit_client().Add(modelVC);
                    #endregion

                    string strResourceUrl = string.Empty;
                    /// BookAttrModel bkAttrModel = GetBookAttrValue(dt.Rows[1]["Book_ID"].ToString());
                    strResourceUrl = Server.MapPath(string.Format("{0}/{1}", Rc.Common.ConfigHelper.GetConfigString("DocumentUrl"), dt.Rows[0]["Resource_Url"].ToString()));

                    string strFileSuffix = string.Empty;
                    strFileSuffix = dt.Rows[0]["File_Suffix"].ToString();
                    if (strFileSuffix == "testPaper")
                    {
                        strFileSuffix = "dsc";
                    }
                    //string strJson = "{isPrint:" + bkAttrModel.IsPrint + ",isSave:" + bkAttrModel.IsSave + "}";
                    pfunction.ToDownloadBase64(strResourceUrl, dt.Rows[0]["Resource_Name"].ToString().ReplaceForFilter() + "." + dt.Rows[0]["File_Suffix"].ToString());
                }
            }
        }
예제 #3
0
        public bool Add(Model_visit_client model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into visit_client(");
            builder.Append("visit_client_id,user_id,resource_data_id,product_type,tab_id,open_time,close_time,operate_type)");
            builder.Append(" values (");
            builder.Append("@visit_client_id,@user_id,@resource_data_id,@product_type,@tab_id,@open_time,@close_time,@operate_type)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@visit_client_id", SqlDbType.Char, 0x24), new SqlParameter("@user_id", SqlDbType.Char, 0x24), new SqlParameter("@resource_data_id", SqlDbType.Char, 0x24), new SqlParameter("@product_type", SqlDbType.VarChar, 50), new SqlParameter("@tab_id", SqlDbType.VarChar, 100), new SqlParameter("@open_time", SqlDbType.DateTime), new SqlParameter("@close_time", SqlDbType.DateTime), new SqlParameter("@operate_type", SqlDbType.VarChar, 10) };
            cmdParms[0].Value = model.visit_client_id;
            cmdParms[1].Value = model.user_id;
            cmdParms[2].Value = model.resource_data_id;
            cmdParms[3].Value = model.product_type;
            cmdParms[4].Value = model.tab_id;
            cmdParms[5].Value = model.open_time;
            cmdParms[6].Value = model.close_time;
            cmdParms[7].Value = model.operate_type;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
예제 #4
0
        public Model_visit_client DataRowToModel(DataRow row)
        {
            Model_visit_client _client = new Model_visit_client();

            if (row != null)
            {
                if (row["visit_client_id"] != null)
                {
                    _client.visit_client_id = row["visit_client_id"].ToString();
                }
                if (row["user_id"] != null)
                {
                    _client.user_id = row["user_id"].ToString();
                }
                if (row["resource_data_id"] != null)
                {
                    _client.resource_data_id = row["resource_data_id"].ToString();
                }
                if (row["product_type"] != null)
                {
                    _client.product_type = row["product_type"].ToString();
                }
                if (row["tab_id"] != null)
                {
                    _client.tab_id = row["tab_id"].ToString();
                }
                if ((row["open_time"] != null) && (row["open_time"].ToString() != ""))
                {
                    _client.open_time = new DateTime?(DateTime.Parse(row["open_time"].ToString()));
                }
                if ((row["close_time"] != null) && (row["close_time"].ToString() != ""))
                {
                    _client.close_time = new DateTime?(DateTime.Parse(row["close_time"].ToString()));
                }
                if (row["operate_type"] != null)
                {
                    _client.operate_type = row["operate_type"].ToString();
                }
            }
            return(_client);
        }
예제 #5
0
        public bool Update(Model_visit_client model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update visit_client set ");
            builder.Append("user_id=@user_id,");
            builder.Append("resource_data_id=@resource_data_id,");
            builder.Append("product_type=@product_type,");
            builder.Append("tab_id=@tab_id,");
            builder.Append("open_time=@open_time,");
            builder.Append("close_time=@close_time,");
            builder.Append("operate_type=@operate_type");
            builder.Append(" where visit_client_id=@visit_client_id ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@user_id", SqlDbType.Char, 0x24), new SqlParameter("@resource_data_id", SqlDbType.Char, 0x24), new SqlParameter("@product_type", SqlDbType.VarChar, 50), new SqlParameter("@tab_id", SqlDbType.VarChar, 100), new SqlParameter("@open_time", SqlDbType.DateTime), new SqlParameter("@close_time", SqlDbType.DateTime), new SqlParameter("@operate_type", SqlDbType.VarChar, 10), new SqlParameter("@visit_client_id", SqlDbType.Char, 0x24) };
            cmdParms[0].Value = model.user_id;
            cmdParms[1].Value = model.resource_data_id;
            cmdParms[2].Value = model.product_type;
            cmdParms[3].Value = model.tab_id;
            cmdParms[4].Value = model.open_time;
            cmdParms[5].Value = model.close_time;
            cmdParms[6].Value = model.operate_type;
            cmdParms[7].Value = model.visit_client_id;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
예제 #6
0
 public bool Add(Model_visit_client model)
 {
     return(this.dal.Add(model));
 }
예제 #7
0
 public bool Update(Model_visit_client model)
 {
     return(this.dal.Update(model));
 }