/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public zlzw.Model.GeneralEnterpriseModel DataRowToModel(DataRow row)
		{
			zlzw.Model.GeneralEnterpriseModel model=new zlzw.Model.GeneralEnterpriseModel();
			if (row != null)
			{
				if(row["EnterpriseID"]!=null && row["EnterpriseID"].ToString()!="")
				{
					model.EnterpriseID=int.Parse(row["EnterpriseID"].ToString());
				}
				if(row["UserGuid"]!=null && row["UserGuid"].ToString()!="")
				{
					model.UserGuid= new Guid(row["UserGuid"].ToString());
				}
				if(row["EnterpriseGuid"]!=null && row["EnterpriseGuid"].ToString()!="")
				{
					model.EnterpriseGuid= new Guid(row["EnterpriseGuid"].ToString());
				}
				if(row["CompanyName"]!=null)
				{
					model.CompanyName=row["CompanyName"].ToString();
				}
				if(row["CompanyNameShort"]!=null)
				{
					model.CompanyNameShort=row["CompanyNameShort"].ToString();
				}
				if(row["BusinessType"]!=null && row["BusinessType"].ToString()!="")
				{
					model.BusinessType=int.Parse(row["BusinessType"].ToString());
				}
				if(row["TradingName"]!=null)
				{
					model.TradingName=row["TradingName"].ToString();
				}
				if(row["IndustryKey"]!=null)
				{
					model.IndustryKey=row["IndustryKey"].ToString();
				}
				if(row["IndustryType"]!=null && row["IndustryType"].ToString()!="")
				{
					model.IndustryType=int.Parse(row["IndustryType"].ToString());
				}
				if(row["EnterpriseCode"]!=null)
				{
					model.EnterpriseCode=row["EnterpriseCode"].ToString();
				}
				if(row["TaxCode"]!=null)
				{
					model.TaxCode=row["TaxCode"].ToString();
				}
				if(row["PrincipleAddress"]!=null)
				{
					model.PrincipleAddress=row["PrincipleAddress"].ToString();
				}
				if(row["PostCode"]!=null)
				{
					model.PostCode=row["PostCode"].ToString();
				}
				if(row["Telephone"]!=null)
				{
					model.Telephone=row["Telephone"].ToString();
				}
				if(row["TelephoneOther"]!=null)
				{
					model.TelephoneOther=row["TelephoneOther"].ToString();
				}
				if(row["Fax"]!=null)
				{
					model.Fax=row["Fax"].ToString();
				}
				if(row["Email"]!=null)
				{
					model.Email=row["Email"].ToString();
				}
				if(row["EstablishedYears"]!=null && row["EstablishedYears"].ToString()!="")
				{
					model.EstablishedYears=int.Parse(row["EstablishedYears"].ToString());
				}
				if(row["EstablishedTime"]!=null && row["EstablishedTime"].ToString()!="")
				{
					model.EstablishedTime=DateTime.Parse(row["EstablishedTime"].ToString());
				}
				if(row["GrossIncome"]!=null && row["GrossIncome"].ToString()!="")
				{
					model.GrossIncome=decimal.Parse(row["GrossIncome"].ToString());
				}
				if(row["Profit"]!=null && row["Profit"].ToString()!="")
				{
					model.Profit=decimal.Parse(row["Profit"].ToString());
				}
				if(row["AssociatedEnterpriseGuid"]!=null && row["AssociatedEnterpriseGuid"].ToString()!="")
				{
					model.AssociatedEnterpriseGuid= new Guid(row["AssociatedEnterpriseGuid"].ToString());
				}
				if(row["ContactPerson"]!=null)
				{
					model.ContactPerson=row["ContactPerson"].ToString();
				}
				if(row["AreaCode"]!=null)
				{
					model.AreaCode=row["AreaCode"].ToString();
				}
				if(row["AreaOther"]!=null)
				{
					model.AreaOther=row["AreaOther"].ToString();
				}
				if(row["CanUsable"]!=null && row["CanUsable"].ToString()!="")
				{
					model.CanUsable=int.Parse(row["CanUsable"].ToString());
				}
				if(row["Longitude"]!=null && row["Longitude"].ToString()!="")
				{
					model.Longitude=decimal.Parse(row["Longitude"].ToString());
				}
				if(row["Lantitude"]!=null && row["Lantitude"].ToString()!="")
				{
					model.Lantitude=decimal.Parse(row["Lantitude"].ToString());
				}
				if(row["BrokerKey"]!=null)
				{
					model.BrokerKey=row["BrokerKey"].ToString();
				}
				if(row["EnterpriseDescription"]!=null)
				{
					model.EnterpriseDescription=row["EnterpriseDescription"].ToString();
				}
				if(row["EnterpriseMemo"]!=null)
				{
					model.EnterpriseMemo=row["EnterpriseMemo"].ToString();
				}
				if(row["EnterpriseAddon"]!=null)
				{
					model.EnterpriseAddon=row["EnterpriseAddon"].ToString();
				}
				if(row["EnterpriseWWW"]!=null)
				{
					model.EnterpriseWWW=row["EnterpriseWWW"].ToString();
				}
				if(row["StaffScope"]!=null && row["StaffScope"].ToString()!="")
				{
					model.StaffScope=int.Parse(row["StaffScope"].ToString());
				}
				if(row["EnterpriseLevel"]!=null && row["EnterpriseLevel"].ToString()!="")
				{
					model.EnterpriseLevel=int.Parse(row["EnterpriseLevel"].ToString());
				}
				if(row["EnterpriseLevel1"]!=null && row["EnterpriseLevel1"].ToString()!="")
				{
					model.EnterpriseLevel1=int.Parse(row["EnterpriseLevel1"].ToString());
				}
				if(row["EnterpriseLevel2"]!=null && row["EnterpriseLevel2"].ToString()!="")
				{
					model.EnterpriseLevel2=int.Parse(row["EnterpriseLevel2"].ToString());
				}
				if(row["EnterpriseLevel3"]!=null && row["EnterpriseLevel3"].ToString()!="")
				{
					model.EnterpriseLevel3=int.Parse(row["EnterpriseLevel3"].ToString());
				}
				if(row["EnterpriseLevel4"]!=null && row["EnterpriseLevel4"].ToString()!="")
				{
					model.EnterpriseLevel4=int.Parse(row["EnterpriseLevel4"].ToString());
				}
				if(row["EnterpriseLevel5"]!=null && row["EnterpriseLevel5"].ToString()!="")
				{
					model.EnterpriseLevel5=int.Parse(row["EnterpriseLevel5"].ToString());
				}
				if(row["EnterpriseLevel6"]!=null && row["EnterpriseLevel6"].ToString()!="")
				{
					model.EnterpriseLevel6=int.Parse(row["EnterpriseLevel6"].ToString());
				}
				if(row["EnterpriseLevel7"]!=null && row["EnterpriseLevel7"].ToString()!="")
				{
					model.EnterpriseLevel7=int.Parse(row["EnterpriseLevel7"].ToString());
				}
				if(row["EnterpriseRank"]!=null)
				{
					model.EnterpriseRank=row["EnterpriseRank"].ToString();
				}
				if(row["EnterpriseKind"]!=null && row["EnterpriseKind"].ToString()!="")
				{
					model.EnterpriseKind=int.Parse(row["EnterpriseKind"].ToString());
				}
				if(row["ManageUserKey"]!=null)
				{
					model.ManageUserKey=row["ManageUserKey"].ToString();
				}
				if(row["ManageUserName"]!=null)
				{
					model.ManageUserName=row["ManageUserName"].ToString();
				}
				if(row["CreateUserKey"]!=null)
				{
					model.CreateUserKey=row["CreateUserKey"].ToString();
				}
				if(row["CreateUserName"]!=null)
				{
					model.CreateUserName=row["CreateUserName"].ToString();
				}
				if(row["CreateDate"]!=null && row["CreateDate"].ToString()!="")
				{
					model.CreateDate=DateTime.Parse(row["CreateDate"].ToString());
				}
				if(row["LastUpdateUserKey"]!=null)
				{
					model.LastUpdateUserKey=row["LastUpdateUserKey"].ToString();
				}
				if(row["LastUpdateUserName"]!=null)
				{
					model.LastUpdateUserName=row["LastUpdateUserName"].ToString();
				}
				if(row["LastUpdateDate"]!=null && row["LastUpdateDate"].ToString()!="")
				{
					model.LastUpdateDate=DateTime.Parse(row["LastUpdateDate"].ToString());
				}
				if(row["IsProtectedByOwner"]!=null && row["IsProtectedByOwner"].ToString()!="")
				{
					model.IsProtectedByOwner=int.Parse(row["IsProtectedByOwner"].ToString());
				}
				if(row["CooperateStatus"]!=null && row["CooperateStatus"].ToString()!="")
				{
					model.CooperateStatus=int.Parse(row["CooperateStatus"].ToString());
				}
				if(row["BusinessLicense"]!=null)
				{
					model.BusinessLicense=row["BusinessLicense"].ToString();
				}
				if(row["ShengName"]!=null)
				{
					model.ShengName=row["ShengName"].ToString();
				}
				if(row["ShengCode"]!=null)
				{
					model.ShengCode=row["ShengCode"].ToString();
				}
				if(row["ShiName"]!=null)
				{
					model.ShiName=row["ShiName"].ToString();
				}
				if(row["ShiCode"]!=null)
				{
					model.ShiCode=row["ShiCode"].ToString();
				}
				if(row["QuName"]!=null)
				{
					model.QuName=row["QuName"].ToString();
				}
				if(row["QuCode"]!=null)
				{
					model.QuCode=row["QuCode"].ToString();
				}
				if(row["BusRoute"]!=null)
				{
					model.BusRoute=row["BusRoute"].ToString();
				}
				if(row["IsEnablePublishJob"]!=null && row["IsEnablePublishJob"].ToString()!="")
				{
					model.IsEnablePublishJob=int.Parse(row["IsEnablePublishJob"].ToString());
				}
				if(row["IsEmergencyRecruitment"]!=null && row["IsEmergencyRecruitment"].ToString()!="")
				{
					model.IsEmergencyRecruitment=int.Parse(row["IsEmergencyRecruitment"].ToString());
				}
				if(row["Expand_PublishJobCount"]!=null && row["Expand_PublishJobCount"].ToString()!="")
				{
					model.Expand_PublishJobCount=int.Parse(row["Expand_PublishJobCount"].ToString());
				}
				if(row["Expand_MainResumeCount"]!=null && row["Expand_MainResumeCount"].ToString()!="")
				{
					model.Expand_MainResumeCount=int.Parse(row["Expand_MainResumeCount"].ToString());
				}
				if(row["Expand_SearchStrangeResumeCount"]!=null && row["Expand_SearchStrangeResumeCount"].ToString()!="")
				{
					model.Expand_SearchStrangeResumeCount=int.Parse(row["Expand_SearchStrangeResumeCount"].ToString());
				}
				if(row["Expand_DownloadStrangeResumeCount"]!=null && row["Expand_DownloadStrangeResumeCount"].ToString()!="")
				{
					model.Expand_DownloadStrangeResumeCount=int.Parse(row["Expand_DownloadStrangeResumeCount"].ToString());
				}
				if(row["Expand_Balance"]!=null && row["Expand_Balance"].ToString()!="")
				{
					model.Expand_Balance=decimal.Parse(row["Expand_Balance"].ToString());
				}
				if(row["Expand_RechargeGUID"]!=null && row["Expand_RechargeGUID"].ToString()!="")
				{
					model.Expand_RechargeGUID= new Guid(row["Expand_RechargeGUID"].ToString());
				}
				if(row["DownloadResume"]!=null && row["DownloadResume"].ToString()!="")
				{
					model.DownloadResume=int.Parse(row["DownloadResume"].ToString());
				}
				if(row["PropertyNames"]!=null)
				{
					model.PropertyNames=row["PropertyNames"].ToString();
				}
				if(row["PropertyValues"]!=null)
				{
					model.PropertyValues=row["PropertyValues"].ToString();
				}
			}
			return model;
		}
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Session["IsEnterpriseSubmit"] != null)
            {
                return;
            }
            zlzw.Model.CoreUserModel coreUserModel = new zlzw.Model.CoreUserModel();
            coreUserModel.UserGuid = Guid.NewGuid();
            coreUserModel.UserName = Request.Form["txbUserName"];//账号
            coreUserModel.Password = Request.Form["txbPassword"];//密码
            coreUserModel.UserMobileNO = Request.Form["txbUserMobileNO"];//手机号
            coreUserModel.UserRegisterDate = DateTime.Now;//用户注册日期
            coreUserModel.UserLastDateTime = DateTime.Now;//用户最后一次登录日期
            coreUserModel.UserType = 2;//企业用户
            coreUserModel.UserStatus = 1;//状态可用

            zlzw.Model.GeneralEnterpriseModel generalEnterpriseModel = new zlzw.Model.GeneralEnterpriseModel();
            generalEnterpriseModel.UserGuid = new Guid(coreUserModel.UserGuid.ToString());//所属账号的GUID
            generalEnterpriseModel.CompanyName = Request.Form["txbEnterpriseName"];//企业名称
            //generalEnterpriseModel.IndustryKey = drpJobFeildKindsType.SelectedValue + "-" + Request.Params["drpItems"];//公司行业
            generalEnterpriseModel.IndustryKey = Get_CurrentValue(Request.Params["txbJobFeildKinds"]) + "-" + Request.Params["txbJobFeildKinds"];//行业类别
            generalEnterpriseModel.PrincipleAddress = Request.Form["txbPrincipleAddress"];//公司地址
            generalEnterpriseModel.Telephone = Request.Form["txbTelephone"];//联系电话
            generalEnterpriseModel.ContactPerson = Request.Form["txbContactPerson"];//联系人
            generalEnterpriseModel.Email = Request.Form["txbEmail"];//电子邮件
            generalEnterpriseModel.EnterpriseWWW = Request.Form["txbEnterpriseWWW"];//公司网站
            generalEnterpriseModel.BusRoute = Request.Form["txbBusRoute"];//乘车路线
            generalEnterpriseModel.CanUsable = 1;
            generalEnterpriseModel.CreateDate = DateTime.Now;//创建日期
            //添加所在省市区信息
            generalEnterpriseModel.ShengName = Request.Form["drpShengList"];//省名称
            generalEnterpriseModel.ShiName = Request.Form["drpShiList"];//市名称
            generalEnterpriseModel.QuName = Request.Form["drpQuList"];//区名称
            generalEnterpriseModel.EnterpriseDescription = Request.Form["txbEnterpriseDescription"];//企业简介
            ////设置企业基本数据
            //generalEnterpriseModel.Expand_PublishJobCount = 0;//企业已发布的职位数
            //generalEnterpriseModel.Expand_MainResumeCount = 0;//企业已查看主投简历数
            //generalEnterpriseModel.Expand_SearchStrangeResumeCount = 0;//企业已搜索陌生简历数
            //generalEnterpriseModel.Expand_DownloadStrangeResumeCount = 0;//企业已下载陌生简历数量
            //generalEnterpriseModel.Expand_Balance = 0;//企业充值金额
            generalEnterpriseModel.IsEmergencyRecruitment = 0;//默认不允许企业发布紧急招聘
            generalEnterpriseModel.DownloadResume = 0;//默认下载陌生简历次数为0
            if (uploadBusinessLicense.HasFile)
            {
                string strFileExt = System.IO.Path.GetExtension(uploadBusinessLicense.FileName);
                if (strFileExt == ".jpg" || strFileExt == ".gif" || strFileExt == ".png" || strFileExt == ".jpeg" || strFileExt == ".bmp")
                {
                    string strFilePath = "~/BusinessLicense/" + txbEnterpriseName.Text + "_" + DateTime.Now.ToString("yyyyMMddhhmmss") + "_" + strFileExt;
                    uploadBusinessLicense.SaveAs(Server.MapPath(strFilePath));
                    generalEnterpriseModel.BusinessLicense = strFilePath;
                }
            }
            try
            {
                zlzw.BLL.CoreUserBLL coreUserBLL = new zlzw.BLL.CoreUserBLL();
                coreUserBLL.Add(coreUserModel);
                zlzw.BLL.GeneralEnterpriseBLL generalEnterpriseBLL = new zlzw.BLL.GeneralEnterpriseBLL();
                generalEnterpriseBLL.Add(generalEnterpriseModel);
                if (Session["IsEnterpriseSubmit"] == null)
                {
                    FineUI.Alert.Show("用户注册成功");
                    Session["IsEnterpriseSubmit"] = "1";
                }
                HttpCookie userGUID = new HttpCookie("CurrentUserGUID", coreUserModel.UserGuid.ToString());
                HttpCookie uerName = new HttpCookie("CurrentUserName", coreUserModel.UserName);
                userGUID.Expires = DateTime.Now.AddDays(1);
                uerName.Expires = DateTime.Now.AddDays(1);
                System.Web.HttpContext.Current.Response.Cookies.Add(userGUID);
                System.Web.HttpContext.Current.Response.Cookies.Add(uerName);
                Response.Redirect("default.aspx");
            }
            catch (Exception exp)
            {
                FineUI.Alert.Show("用户注册失败,请稍后重试");
            }
        }
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public zlzw.Model.GeneralEnterpriseModel GetModel(int EnterpriseID)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@EnterpriseID", SqlDbType.Int,4)
			};
			parameters[0].Value = EnterpriseID;

			zlzw.Model.GeneralEnterpriseModel model=new zlzw.Model.GeneralEnterpriseModel();
			DataSet ds= DbHelperSQL.RunProcedure("GeneralEnterprise_GetModel",parameters,"ds");
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["Type"] == "1")
            {
                //编辑保存
                zlzw.Model.GeneralEnterpriseModel generalEnterpriseModel = new zlzw.Model.GeneralEnterpriseModel();
                generalEnterpriseModel.CompanyName = txbCompanyName.Text;//企业名称
                generalEnterpriseModel.IndustryKey = drpIndustryKey.SelectedValue;//所属行业
                generalEnterpriseModel.ShengCode = ddlSheng.SelectedValue;//企业所在省代码
                generalEnterpriseModel.ShiCode = ddlShi.SelectedValue;//企业所在市代码
                generalEnterpriseModel.QuCode = ddlXian.SelectedValue;//企业所在区代码
                generalEnterpriseModel.PrincipleAddress = txbPrincipleAddress.Text;//企业所在地址
                generalEnterpriseModel.Telephone = txbTelephone.Text;//联系电话
                generalEnterpriseModel.TelephoneOther = txbTelephoneOther.Text;//其他联系电话
                generalEnterpriseModel.Fax = txbFax.Text;//传真
                generalEnterpriseModel.Email = txbEmail.Text;//电子邮件
                generalEnterpriseModel.ContactPerson = txbContactPerson.Text;//联系人
                generalEnterpriseModel.EnterpriseWWW = txbEnterpriseWWW.Text;//企业网址
                generalEnterpriseModel.BusRoute = txbBusRoute.Text;//乘车路线
                generalEnterpriseModel.EnterpriseDescription = txbEnterpriseDescription.Text;//企业简介
                generalEnterpriseModel.CanUsable = 1;
                if (ckbIsEmergencyRecruitment.Checked)
                {
                    generalEnterpriseModel.IsEmergencyRecruitment = 1;
                }
                else
                {
                    generalEnterpriseModel.IsEmergencyRecruitment = 0;
                }
                //是否允许职位发布
                if (ckbIsEnablePublishJob.Checked)
                {
                    generalEnterpriseModel.IsEnablePublishJob = 1;
                }
                else
                {
                    generalEnterpriseModel.IsEnablePublishJob = 0;
                }
                generalEnterpriseModel.DownloadResume = int.Parse(txbDownloadResume.Text);//允许下载陌生简历数量
                generalEnterpriseModel.CreateDate = DateTime.Parse(ViewState["CreateDate"].ToString());
                zlzw.BLL.GeneralEnterpriseBLL generalEnterpriseBLL = new zlzw.BLL.GeneralEnterpriseBLL();
                generalEnterpriseModel.EnterpriseID = int.Parse(Get_ID(generalEnterpriseBLL, Request.QueryString["value"]));
                if (fileBusinessLicense.PostedFile.ContentLength > 0)
                {
                    fileBusinessLicense.SaveAs(Server.MapPath(ViewState["fileBusinessLicense"].ToString()));
                    generalEnterpriseModel.BusinessLicense = ViewState["fileBusinessLicense"].ToString();
                }
                else
                {
                    generalEnterpriseModel.BusinessLicense = ViewState["fileBusinessLicense"].ToString();
                }
                generalEnterpriseModel.UserGuid = new Guid(ViewState["UserGuid"].ToString());
                generalEnterpriseModel.EnterpriseGuid = new Guid(ViewState["EnterpriseGuid"].ToString());
                generalEnterpriseBLL.Update(generalEnterpriseModel);
            }
            else
            {
                //添加保存

                zlzw.Model.GeneralEnterpriseModel generalEnterpriseModel = new zlzw.Model.GeneralEnterpriseModel();
                generalEnterpriseModel.CompanyName = txbCompanyName.Text;//企业名称
                generalEnterpriseModel.IndustryKey = drpIndustryKey.SelectedValue;//所属行业
                generalEnterpriseModel.ShengCode = ddlSheng.SelectedValue;//企业所在省代码
                generalEnterpriseModel.ShiCode = ddlShi.SelectedValue;//企业所在市代码
                generalEnterpriseModel.QuCode = ddlXian.SelectedValue;//企业所在区代码
                generalEnterpriseModel.PrincipleAddress = txbPrincipleAddress.Text;//企业所在地址
                generalEnterpriseModel.Telephone = txbTelephone.Text;//联系电话
                generalEnterpriseModel.TelephoneOther = txbTelephoneOther.Text;//其他联系电话
                generalEnterpriseModel.Fax = txbFax.Text;//传真
                generalEnterpriseModel.Email = txbEmail.Text;//电子邮件
                generalEnterpriseModel.ContactPerson = txbContactPerson.Text;//联系人
                generalEnterpriseModel.EnterpriseWWW = txbEnterpriseWWW.Text;//企业网址
                generalEnterpriseModel.BusRoute = txbBusRoute.Text;//乘车路线
                generalEnterpriseModel.EnterpriseDescription = txbEnterpriseDescription.Text;//企业简介
                generalEnterpriseModel.CreateDate = DateTime.Now;//企业系统创建日期
                generalEnterpriseModel.CanUsable = 1;//可用
                generalEnterpriseModel.UserGuid = new Guid(Request.Cookies["UserID"].Value);
                if (ckbIsEmergencyRecruitment.Checked)
                {
                    generalEnterpriseModel.IsEmergencyRecruitment = 1;
                }
                else
                {
                    generalEnterpriseModel.IsEmergencyRecruitment = 0;
                }
                //是否允许职位发布
                //是否允许职位发布
                if (ckbIsEnablePublishJob.Checked)
                {
                    generalEnterpriseModel.IsEnablePublishJob = 1;
                }
                else
                {
                    generalEnterpriseModel.IsEnablePublishJob = 0;
                }
                generalEnterpriseModel.DownloadResume = int.Parse(txbDownloadResume.Text);//允许下载陌生简历数量
                generalEnterpriseModel.UserGuid = new Guid(Request.Cookies["UserID"].Value);
                if (fileBusinessLicense.PostedFile.ContentLength > 0)
                {
                    string fileName = DateTime.Now.Ticks.ToString() + "_" + fileBusinessLicense.FileName;
                    fileBusinessLicense.SaveAs(Server.MapPath("~/UploadImages/" + fileName));
                    generalEnterpriseModel.BusinessLicense = "~/UploadImages/" + fileName;//保存营业执照图片路径
                }
                zlzw.BLL.GeneralEnterpriseBLL generalEnterpriseBLL = new zlzw.BLL.GeneralEnterpriseBLL();
                generalEnterpriseBLL.Add(generalEnterpriseModel);
            }

            // 2. Close this window and Refresh parent window
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
        }