protected void init_form(string ctrID)
        {
            if (!string.IsNullOrEmpty(ctrID))
            {
                _WG_VenderEntity = DataProvider.GetInstance().GetWG_VenderEntity(int.Parse(ctrID));

               				                				                   TextBox_VenderName.Text = _WG_VenderEntity.VenderName.ToString();
                                				                   TextBox_VenderType.Text = _WG_VenderEntity.VenderType.ToString();
                                				                   TextBox_Logo.Text = _WG_VenderEntity.Logo.ToString();
                                				                   TextBox_Address.Text = _WG_VenderEntity.Address.ToString();
                                				                   TextBox_ComLevel.Text = _WG_VenderEntity.ComLevel.ToString();
                                				                   TextBox_Phone.Text = _WG_VenderEntity.Phone.ToString();
                                				                   TextBox_Memo.Text = _WG_VenderEntity.Memo.ToString();
                                				                            }
        }
        private MideFrameWork.Data.Entity.WG_VenderEntity GetWG_Vender(DataRow dr)
        {
            MideFrameWork.Data.Entity.WG_VenderEntity info = new MideFrameWork.Data.Entity.WG_VenderEntity();
										if(DBNull.Value==dr["ID"])
					info.ID=0;
				else
					info.ID=int.Parse(dr["ID"].ToString());
									
																								
						if(DBNull.Value==dr["VenderName"])
				info.VenderName= string.Empty;
			else	
				info.VenderName= dr["VenderName"].ToString();
																						if(DBNull.Value==dr["VenderType"])
					info.VenderType=0;
				else
					info.VenderType=int.Parse(dr["VenderType"].ToString());
									
																								
						if(DBNull.Value==dr["Logo"])
				info.Logo= string.Empty;
			else	
				info.Logo= dr["Logo"].ToString();
																								
						if(DBNull.Value==dr["Address"])
				info.Address= string.Empty;
			else	
				info.Address= dr["Address"].ToString();
																								
						if(DBNull.Value==dr["ComLevel"])
				info.ComLevel= string.Empty;
			else	
				info.ComLevel= dr["ComLevel"].ToString();
																								
						if(DBNull.Value==dr["Phone"])
				info.Phone= string.Empty;
			else	
				info.Phone= dr["Phone"].ToString();
																								
						if(DBNull.Value==dr["Memo"])
				info.Memo= string.Empty;
			else	
				info.Memo= dr["Memo"].ToString();
																									if(DBNull.Value==dr["CreateDate"])
					info.CreateDate=DateTime.Now;
				else
					info.CreateDate=DateTime.Parse(dr["CreateDate"].ToString());
						
															            return info;
        }
        protected void WG_VenderAdd()
        {
            #region 判断是否可空
		 
                                                                          
                  var _VenderName = Request.Form["TextBox_VenderName"];
                 if (string.IsNullOrEmpty(_VenderName))
                   {
                        Alert("[ 商家名称 ]不能为空");
                        return;
                  }
				                                           
                  var _VenderType = Request.Form["TextBox_VenderType"];
                 if (string.IsNullOrEmpty(_VenderType))
                   {
                        Alert("[ 商家类别 ]不能为空");
                        return;
                  }
				                                           
                  var _Logo = Request.Form["TextBox_Logo"];
                 if (string.IsNullOrEmpty(_Logo))
                   {
                        Alert("[ 图片 ]不能为空");
                        return;
                  }
				                                           
                  var _Address = Request.Form["TextBox_Address"];
                 if (string.IsNullOrEmpty(_Address))
                   {
                        Alert("[ 地址 ]不能为空");
                        return;
                  }
				                                           
                  var _ComLevel = Request.Form["TextBox_ComLevel"];
                 if (string.IsNullOrEmpty(_ComLevel))
                   {
                        Alert("[ 合作等级 ]不能为空");
                        return;
                  }
				                                           
                  var _Phone = Request.Form["TextBox_Phone"];
                 if (string.IsNullOrEmpty(_Phone))
                   {
                        Alert("[ 联系电话 ]不能为空");
                        return;
                  }
				                                           
                  var _Memo = Request.Form["TextBox_Memo"];
                 if (string.IsNullOrEmpty(_Memo))
                   {
                        Alert("[ 备注 ]不能为空");
                        return;
                  }
				                                                
	        #endregion
           
            #region 获取数据

            WG_VenderEntity  _WG_VenderEntity = new WG_VenderEntity();
            
               		                               	  		                            
                 	                 	                
                    _WG_VenderEntity.VenderName =Convert.ToString(_VenderName.ToString());
               		                        	  		                            
                 	                 	                     _WG_VenderEntity.VenderType =Convert.ToInt32(_VenderType.ToString());
                	                        	  		                            
                 	                 	                
                    _WG_VenderEntity.Logo =Convert.ToString(_Logo.ToString());
               		                        	  		                            
                 	                 	                
                    _WG_VenderEntity.Address =Convert.ToString(_Address.ToString());
               		                        	  		                            
                 	                 	                
                    _WG_VenderEntity.ComLevel =Convert.ToString(_ComLevel.ToString());
               		                        	  		                            
                 	                 	                
                    _WG_VenderEntity.Phone =Convert.ToString(_Phone.ToString());
               		                        	  		                            
                 	                 	                
                    _WG_VenderEntity.Memo =Convert.ToString(_Memo.ToString());
               		                        	  		        
		       	_WG_VenderEntity.CreateDate =DateTime.Now;
		               	              try
            {
                DataProvider.GetInstance().AddWG_Vender(_WG_VenderEntity);
            }
            catch
            {
                WriteLog("WG_VenderAdd", "添加WG_Vender", "插入数据库时出错", Common.DailyUtility.MideSmsType.LogType.SystemLog);
                Alert("添加数据时出错,请重试");
                return;
            }
            Alert("添加WG_Vender成功");
        }