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

               				                				                   TextBox_Title.Text = _WG_HelpRequestEntity.Title.ToString();
                                				                   TextBox_Type.Text = _WG_HelpRequestEntity.Type.ToString();
                                				                   TextBox_PromoterID.Text = _WG_HelpRequestEntity.PromoterID.ToString();
                                				                   TextBox_LinkMan.Text = _WG_HelpRequestEntity.LinkMan.ToString();
                                				                   TextBox_LinkPhone.Text = _WG_HelpRequestEntity.LinkPhone.ToString();
                                				                   TextBox_BeginTime.Text = _WG_HelpRequestEntity.BeginTime.ToString();
                                				                   TextBox_Region.Text = _WG_HelpRequestEntity.Region.ToString();
                                				                   TextBox_ServiceIntention.Text = _WG_HelpRequestEntity.ServiceIntention.ToString();
                                				                   TextBox_Duration.Text = _WG_HelpRequestEntity.Duration.ToString();
                                				                   TextBox_Detail.Text = _WG_HelpRequestEntity.Detail.ToString();
                                				                   TextBox_UnderTakerID.Text = _WG_HelpRequestEntity.UnderTakerID.ToString();
                                				                   TextBox_Status.Text = _WG_HelpRequestEntity.Status.ToString();
                                				                				                            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.AddHeader("Access-Control-Allow-Origin", "*");
            context.Response.AddHeader("Access-Control-Allow-Methods", "POST");
            context.Response.AddHeader("Access-Control-Allow-Headers", "x-requested-with,content-type");
            context.Response.ContentType = "text/plain";

            JsonBaseObject jbo = new JsonBaseObject();
            string result = string.Empty;
            try
            {
                string title = context.Request["title"];
                string type = context.Request["type"];
                string promoterID = context.Request["promoterID"];
                string linkman = context.Request["linkman"];
                string linkphone = context.Request["linkphone"];
                string beginTime = context.Request["beginTime"];
                string region = context.Request["region"];
                string serviceIntention = context.Request["serviceIntention"];
                string duration = context.Request["duration"];
                string detail = context.Request["detail"];
                string status = context.Request["status"];

                if (!string.IsNullOrEmpty(title) 
                    && !string.IsNullOrEmpty(linkphone)
                    && !string.IsNullOrEmpty(promoterID))
                {
                    WG_HelpRequestEntity currEntity = new WG_HelpRequestEntity();
                    currEntity.Title = title;
                    currEntity.Type = int.Parse(type);//1为求助,2为帮助
                    currEntity.PromoterID = int.Parse(promoterID);//提交人的ID
                    currEntity.LinkMan = linkman;
                    currEntity.LinkPhone = linkphone;
                    currEntity.BeginTime = Convert.ToDateTime(beginTime);
                    currEntity.Region = region;
                    currEntity.ServiceIntention = serviceIntention;
                    currEntity.Duration = int.Parse(duration);
                    currEntity.Detail = detail;
                    currEntity.Status = 0;// int.Parse(status);//0待匹配,1已匹配,2,已完成。
                    //注册,所以不用制定undertakerID
                    currEntity.CreateDate = DateTime.Now;
                    currEntity.UpdateDate = DateTime.Now;
                    int addResult = DataProvider.GetInstance().AddWG_HelpRequest(currEntity);
                    if (addResult < 0)
                    {
                        //失败
                        jbo.code = -1;
                        jbo.data = null;
                        jbo.message = "新增过程中失败";
                        jbo.success = false;
                    }
                    else
                    {
                        //成功
                        jbo.code = 0;
                        jbo.data = null;
                        jbo.message = "成功";
                        jbo.success = true;
                    }
                }
                else
                {
                    //最基本必须有标题和联系人电话,否则失败
                    //失败
                    jbo.code = -1;
                    jbo.data = null;
                    jbo.message = "标题或联系电话必须不能为空。";
                    jbo.success = false;
                }
            }
            catch (Exception ex)
            {
                jbo.code = -1;
                jbo.data = null;
                jbo.message = "接口调用过程中出现异常。";
                jbo.success = false;
            }

            #region 返回json

            result = JsonSerializer<JsonBaseObject>(jbo);
            context.Response.Write(result);

            #endregion
        }
        private MideFrameWork.Data.Entity.WG_HelpRequestEntity GetWG_HelpRequest(DataRow dr)
        {
            MideFrameWork.Data.Entity.WG_HelpRequestEntity info = new MideFrameWork.Data.Entity.WG_HelpRequestEntity();
										if(DBNull.Value==dr["ID"])
					info.ID=0;
				else
					info.ID=int.Parse(dr["ID"].ToString());
									
																								
						if(DBNull.Value==dr["Title"])
				info.Title= string.Empty;
			else	
				info.Title= dr["Title"].ToString();
																						if(DBNull.Value==dr["Type"])
					info.Type=0;
				else
					info.Type=int.Parse(dr["Type"].ToString());
									
																						if(DBNull.Value==dr["PromoterID"])
					info.PromoterID=0;
				else
					info.PromoterID=int.Parse(dr["PromoterID"].ToString());
									
																								
						if(DBNull.Value==dr["LinkMan"])
				info.LinkMan= string.Empty;
			else	
				info.LinkMan= dr["LinkMan"].ToString();
																								
						if(DBNull.Value==dr["LinkPhone"])
				info.LinkPhone= string.Empty;
			else	
				info.LinkPhone= dr["LinkPhone"].ToString();
																									if(DBNull.Value==dr["BeginTime"])
					info.BeginTime=DateTime.Now;
				else
					info.BeginTime=DateTime.Parse(dr["BeginTime"].ToString());
						
																								
						if(DBNull.Value==dr["Region"])
				info.Region= string.Empty;
			else	
				info.Region= dr["Region"].ToString();
																								
						if(DBNull.Value==dr["ServiceIntention"])
				info.ServiceIntention= string.Empty;
			else	
				info.ServiceIntention= dr["ServiceIntention"].ToString();
																						if(DBNull.Value==dr["Duration"])
					info.Duration=0;
				else
					info.Duration=int.Parse(dr["Duration"].ToString());
									
																								
						if(DBNull.Value==dr["Detail"])
				info.Detail= string.Empty;
			else	
				info.Detail= dr["Detail"].ToString();
																						if(DBNull.Value==dr["UnderTakerID"])
					info.UnderTakerID=0;
				else
					info.UnderTakerID=int.Parse(dr["UnderTakerID"].ToString());
									
																						if(DBNull.Value==dr["Status"])
					info.Status=0;
				else
					info.Status=int.Parse(dr["Status"].ToString());
									
																								
						if(DBNull.Value==dr["Verification"])
				info.Verification= string.Empty;
			else	
				info.Verification= dr["Verification"].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());
						
																									if(DBNull.Value==dr["UpdateDate"])
					info.UpdateDate=DateTime.Now;
				else
					info.UpdateDate=DateTime.Parse(dr["UpdateDate"].ToString());
						
															            return info;
        }
        protected void WG_HelpRequestAdd()
        {
            #region 判断是否可空
		 
                                                                          
                  var _Title = Request.Form["TextBox_Title"];
                 if (string.IsNullOrEmpty(_Title))
                   {
                        Alert("[ 求助标题 ]不能为空");
                        return;
                  }
				                                           
                  var _Type = Request.Form["TextBox_Type"];
                 if (string.IsNullOrEmpty(_Type))
                   {
                        Alert("[ 类别(1求助,2帮助) ]不能为空");
                        return;
                  }
				                                           
                  var _PromoterID = Request.Form["TextBox_PromoterID"];
                 if (string.IsNullOrEmpty(_PromoterID))
                   {
                        Alert("[ 发起人ID ]不能为空");
                        return;
                  }
				                                           
                  var _LinkMan = Request.Form["TextBox_LinkMan"];
                 if (string.IsNullOrEmpty(_LinkMan))
                   {
                        Alert("[ 联系人 ]不能为空");
                        return;
                  }
				                                           
                  var _LinkPhone = Request.Form["TextBox_LinkPhone"];
                 if (string.IsNullOrEmpty(_LinkPhone))
                   {
                        Alert("[ 联系电话 ]不能为空");
                        return;
                  }
				                                           
                  var _BeginTime = Request.Form["TextBox_BeginTime"];
                 if (string.IsNullOrEmpty(_BeginTime))
                   {
                        Alert("[ 求助日期 ]不能为空");
                        return;
                  }
				                                           
                  var _Region = Request.Form["TextBox_Region"];
                 if (string.IsNullOrEmpty(_Region))
                   {
                        Alert("[ 区域ID ]不能为空");
                        return;
                  }
				                                           
                  var _ServiceIntention = Request.Form["TextBox_ServiceIntention"];
                 if (string.IsNullOrEmpty(_ServiceIntention))
                   {
                        Alert("[ 服务时段 ]不能为空");
                        return;
                  }
				                                           
                  var _Duration = Request.Form["TextBox_Duration"];
                 if (string.IsNullOrEmpty(_Duration))
                   {
                        Alert("[ 服务时长 ]不能为空");
                        return;
                  }
				                                           
                  var _Detail = Request.Form["TextBox_Detail"];
                 if (string.IsNullOrEmpty(_Detail))
                   {
                        Alert("[ 服务明细 ]不能为空");
                        return;
                  }
				                                           
                  var _UnderTakerID = Request.Form["TextBox_UnderTakerID"];
                 if (string.IsNullOrEmpty(_UnderTakerID))
                   {
                        Alert("[ 承接者 ]不能为空");
                        return;
                  }
				                                           
                  var _Status = Request.Form["TextBox_Status"];
                 if (string.IsNullOrEmpty(_Status))
                   {
                        Alert("[ 当前状态 ]不能为空");
                        return;
                  }
				                                                                                
	        #endregion
           
            #region 获取数据

            WG_HelpRequestEntity  _WG_HelpRequestEntity = new WG_HelpRequestEntity();
            
               		                               	  		                            
                 	                 	                
                    _WG_HelpRequestEntity.Title =Convert.ToString(_Title.ToString());
               		                        	  		                            
                 	                 	                     _WG_HelpRequestEntity.Type =Convert.ToInt32(_Type.ToString());
                	                        	  		                            
                 	                 	                     _WG_HelpRequestEntity.PromoterID =Convert.ToInt32(_PromoterID.ToString());
                	                        	  		                            
                 	                 	                
                    _WG_HelpRequestEntity.LinkMan =Convert.ToString(_LinkMan.ToString());
               		                        	  		                            
                 	                 	                
                    _WG_HelpRequestEntity.LinkPhone =Convert.ToString(_LinkPhone.ToString());
               		                        	  		                            
                 	                      _WG_HelpRequestEntity.BeginTime = Convert.ToDateTime(_BeginTime.ToString());
                 	                        	  		                            
                 	                 	                
                    _WG_HelpRequestEntity.Region =Convert.ToString(_Region.ToString());
               		                        	  		                            
                 	                 	                
                    _WG_HelpRequestEntity.ServiceIntention =Convert.ToString(_ServiceIntention.ToString());
               		                        	  		                            
                 	                 	                     _WG_HelpRequestEntity.Duration =Convert.ToInt32(_Duration.ToString());
                	                        	  		                            
                 	                 	                
                    _WG_HelpRequestEntity.Detail =Convert.ToString(_Detail.ToString());
               		                        	  		                            
                 	                 	                     _WG_HelpRequestEntity.UnderTakerID =Convert.ToInt32(_UnderTakerID.ToString());
                	                        	  		                            
                 	                 	                     _WG_HelpRequestEntity.Status =Convert.ToInt32(_Status.ToString());
                	                        	  		        
		       	_WG_HelpRequestEntity.CreateDate =DateTime.Now;
		               	  		        
		       	_WG_HelpRequestEntity.UpdateDate =DateTime.Now;
		               	              try
            {
                DataProvider.GetInstance().AddWG_HelpRequest(_WG_HelpRequestEntity);
            }
            catch
            {
                WriteLog("WG_HelpRequestAdd", "添加WG_HelpRequest", "插入数据库时出错", Common.DailyUtility.MideSmsType.LogType.SystemLog);
                Alert("添加数据时出错,请重试");
                return;
            }
            Alert("添加WG_HelpRequest成功");
        }