Ejemplo n.º 1
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            if (grid1.SelectedRowIndexArray != null && grid1.SelectedRowIndexArray.Length > 0)
            {
                string strSelectID = "0";
                for (int i = 0, count = grid1.SelectedRowIndexArray.Length; i < count; i++)
                {
                    int rowIndex = grid1.SelectedRowIndexArray[i];
                    foreach (object key in grid1.DataKeys[rowIndex])
                    {
                        strSelectID = key.ToString();
                    }
                }
                #region  除逻辑

                zlzw.BLL.PartnersListBLL partnersListBLL = new zlzw.BLL.PartnersListBLL();
                DataTable dt = partnersListBLL.GetList("PartnerGUID='" + strSelectID + "'").Tables[0];
                zlzw.Model.PartnersListModel partnersListModal = partnersListBLL.GetModel(int.Parse(dt.Rows[0]["PartnerID"].ToString()));
                partnersListModal.IsEnable = 0;
                partnersListBLL.Update(partnersListModal);
                PartnersList_BindGrid();

                #endregion
            }
            else
            {
                return;
            }
        }
Ejemplo n.º 2
0
 private void LoadData(string strType)
 {
     if (strType == "1")
     {
         string strID = Request.QueryString["value"];//操作ID
         zlzw.BLL.PartnersListBLL partnersListBLL = new zlzw.BLL.PartnersListBLL();
         DataTable dt = partnersListBLL.GetList("PartnerGUID='" + strID + "'").Tables[0];
         zlzw.Model.PartnersListModel partnersListModal = partnersListBLL.GetModel(int.Parse(dt.Rows[0]["PartnerID"].ToString()));
         txbPartnersName.Text    = partnersListModal.PartnerName;         //合作伙伴名称
         txbPartner.Text         = partnersListModal.PartnerIntroduction; //合作伙伴简介
         txbJobContactAdd.Text   = partnersListModal.JobContactAdd;       //联系地址
         txbJobContactPhone.Text = partnersListModal.JobContactPhone;     //联系电话
         txbJobContactName.Text  = partnersListModal.JobContactName;      //联系人
         if (partnersListModal.IsHot == 1)
         {
             ckbIsHot.Checked = true;
         }
         else
         {
             ckbIsHot.Checked = false;
         }
         imgUploadLogo.ImageUrl     = partnersListModal.PartnerLogo;   //显示上传后的图片
         imgUploadBanner.ImageUrl   = partnersListModal.PartnerBanner; //显示上传后的图片
         imgUploadLogo.Visible      = true;
         imgUploadBanner.Visible    = true;
         ViewState["PartnerLogo"]   = partnersListModal.PartnerLogo;   //合作伙伴图片地址
         ViewState["PartnerBanner"] = partnersListModal.PartnerBanner; //合作伙伴Banner
         ViewState["PublishDate"]   = partnersListModal.PublishDate.ToString();
         ViewState["PartnersGUID"]  = partnersListModal.PartnerGUID.ToString();
         ToolbarText2.Text          = "编辑一个岗位";
     }
     btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference();
 }
Ejemplo n.º 3
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(zlzw.Model.PartnersListModel model)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters =
            {
                new SqlParameter("@PartnerID",           SqlDbType.Int,                4),
                new SqlParameter("@PartnerGUID",         SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@PartnerName",         SqlDbType.NVarChar,         200),
                new SqlParameter("@PartnerTitle",        SqlDbType.NVarChar,         200),
                new SqlParameter("@PartnerIntroduction", SqlDbType.NVarChar,          -1),
                new SqlParameter("@PartnerLogo",         SqlDbType.NVarChar,         200),
                new SqlParameter("@PartnerBanner",       SqlDbType.NVarChar,         200),
                new SqlParameter("@PartnerKind",         SqlDbType.Int,                4),
                new SqlParameter("@PartnerCategory",     SqlDbType.NVarChar,          50),
                new SqlParameter("@IsHot",               SqlDbType.Int,                4),
                new SqlParameter("@IsEnable",            SqlDbType.Int,                4),
                new SqlParameter("@PublishDate",         SqlDbType.DateTime),
                new SqlParameter("@JobContactName",      SqlDbType.NVarChar,          50),
                new SqlParameter("@JobContactAdd",       SqlDbType.NVarChar,          50),
                new SqlParameter("@JobContactPhone",     SqlDbType.NVarChar,          50),
                new SqlParameter("@Other01",             SqlDbType.NVarChar,          50),
                new SqlParameter("@Other02",             SqlDbType.NVarChar,          50),
                new SqlParameter("@Other03",             SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.PartnerID;
            parameters[1].Value  = model.PartnerGUID;
            parameters[2].Value  = model.PartnerName;
            parameters[3].Value  = model.PartnerTitle;
            parameters[4].Value  = model.PartnerIntroduction;
            parameters[5].Value  = model.PartnerLogo;
            parameters[6].Value  = model.PartnerBanner;
            parameters[7].Value  = model.PartnerKind;
            parameters[8].Value  = model.PartnerCategory;
            parameters[9].Value  = model.IsHot;
            parameters[10].Value = model.IsEnable;
            parameters[11].Value = model.PublishDate;
            parameters[12].Value = model.JobContactName;
            parameters[13].Value = model.JobContactAdd;
            parameters[14].Value = model.JobContactPhone;
            parameters[15].Value = model.Other01;
            parameters[16].Value = model.Other02;
            parameters[17].Value = model.Other03;

            DbHelperSQL.RunProcedure("PartnersList_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public zlzw.Model.PartnersListModel GetModel(int PartnerID)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@PartnerID", SqlDbType.Int, 4)
            };
            parameters[0].Value = PartnerID;

            zlzw.Model.PartnersListModel model = new zlzw.Model.PartnersListModel();
            DataSet ds = DbHelperSQL.RunProcedure("PartnersList_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["Type"] == "1")
            {
                //编辑保存
                zlzw.Model.PartnersListModel partnersListModal = new zlzw.Model.PartnersListModel();
                partnersListModal.PartnerName         = txbPartnersName.Text; //合作伙伴名称
                partnersListModal.PartnerIntroduction = txbPartner.Text;      //合作伙伴简介

                if (btnImageUpload.PostedFile.ContentLength > 0)
                {
                    btnImageUpload.SaveAs(Server.MapPath(ViewState["PartnerLogo"].ToString()));
                    partnersListModal.PartnerLogo = ViewState["PartnerLogo"].ToString();//保存企业Logo路径
                }
                else
                {
                    partnersListModal.PartnerLogo = ViewState["PartnerLogo"].ToString();
                }

                if (btnBannerUpload.PostedFile.ContentLength > 0)
                {
                    btnBannerUpload.SaveAs(Server.MapPath(ViewState["PartnerBanner"].ToString()));
                    partnersListModal.PartnerBanner = ViewState["PartnerBanner"].ToString();//保存企业Logo路径
                }
                else
                {
                    partnersListModal.PartnerBanner = ViewState["PartnerBanner"].ToString();
                }

                if (ckbIsHot.Checked)
                {
                    partnersListModal.IsHot = 1;
                }
                else
                {
                    partnersListModal.IsHot = 0;
                }
                partnersListModal.JobContactAdd   = txbJobContactAdd.Text;   //联系地址
                partnersListModal.JobContactPhone = txbJobContactPhone.Text; //联系电话
                partnersListModal.JobContactName  = txbJobContactName.Text;  //联系人
                partnersListModal.IsEnable        = 1;
                partnersListModal.PublishDate     = DateTime.Parse(ViewState["PublishDate"].ToString());
                partnersListModal.PartnerID       = int.Parse(Get_PartnersID(Request.QueryString["value"]));
                partnersListModal.PartnerGUID     = new Guid(Request.QueryString["value"]);
                zlzw.BLL.PartnersListBLL partnersListBLL = new zlzw.BLL.PartnersListBLL();
                partnersListBLL.Update(partnersListModal);
            }
            else
            {
                //添加保存
                zlzw.Model.PartnersListModel partnersListModal = new zlzw.Model.PartnersListModel();
                partnersListModal.PartnerName         = txbPartnersName.Text; //合作伙伴名称
                partnersListModal.PartnerIntroduction = txbPartner.Text;      //合作伙伴简介
                partnersListModal.IsEnable            = 1;
                if (ckbIsHot.Checked)
                {
                    partnersListModal.IsHot = 1;
                }
                else
                {
                    partnersListModal.IsHot = 0;
                }
                if (btnImageUpload.HasFile)
                {
                    string fileName = DateTime.Now.Ticks.ToString() + "_" + btnImageUpload.FileName;
                    btnImageUpload.SaveAs(Server.MapPath("~/PartnersLogo/" + fileName));
                    partnersListModal.PartnerLogo = "~/PartnersLogo/" + fileName;//保存企业Logo路径
                }
                else
                {
                    Alert.Show("请上传一张尺寸为137 * 70 的企业Logo", "错误提醒", MessageBoxIcon.Error);
                    return;
                }
                if (btnBannerUpload.HasFile)
                {
                    string fileName = DateTime.Now.Ticks.ToString() + "_" + btnBannerUpload.FileName;
                    btnBannerUpload.SaveAs(Server.MapPath("~/PartnersBanner/" + fileName));
                    partnersListModal.PartnerBanner = "~/PartnersBanner/" + fileName;//保存企业Logo路径
                }
                else
                {
                    Alert.Show("请上传一张宽度为1024px的企业Banner", "错误提醒", MessageBoxIcon.Error);
                    return;
                }
                partnersListModal.JobContactAdd   = txbJobContactAdd.Text;   //联系地址
                partnersListModal.JobContactPhone = txbJobContactPhone.Text; //联系电话
                partnersListModal.JobContactName  = txbJobContactName.Text;  //联系人
                partnersListModal.PartnerGUID     = Guid.NewGuid();
                partnersListModal.PublishDate     = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));

                zlzw.BLL.PartnersListBLL partnersListBLL = new zlzw.BLL.PartnersListBLL();
                partnersListBLL.Add(partnersListModal);
            }

            // 2. Close this window and Refresh parent window
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public zlzw.Model.PartnersListModel DataRowToModel(DataRow row)
 {
     zlzw.Model.PartnersListModel model = new zlzw.Model.PartnersListModel();
     if (row != null)
     {
         if (row["PartnerID"] != null && row["PartnerID"].ToString() != "")
         {
             model.PartnerID = int.Parse(row["PartnerID"].ToString());
         }
         if (row["PartnerGUID"] != null && row["PartnerGUID"].ToString() != "")
         {
             model.PartnerGUID = new Guid(row["PartnerGUID"].ToString());
         }
         if (row["PartnerName"] != null)
         {
             model.PartnerName = row["PartnerName"].ToString();
         }
         if (row["PartnerTitle"] != null)
         {
             model.PartnerTitle = row["PartnerTitle"].ToString();
         }
         if (row["PartnerIntroduction"] != null)
         {
             model.PartnerIntroduction = row["PartnerIntroduction"].ToString();
         }
         if (row["PartnerLogo"] != null)
         {
             model.PartnerLogo = row["PartnerLogo"].ToString();
         }
         if (row["PartnerBanner"] != null)
         {
             model.PartnerBanner = row["PartnerBanner"].ToString();
         }
         if (row["PartnerKind"] != null && row["PartnerKind"].ToString() != "")
         {
             model.PartnerKind = int.Parse(row["PartnerKind"].ToString());
         }
         if (row["PartnerCategory"] != null)
         {
             model.PartnerCategory = row["PartnerCategory"].ToString();
         }
         if (row["IsHot"] != null && row["IsHot"].ToString() != "")
         {
             model.IsHot = int.Parse(row["IsHot"].ToString());
         }
         if (row["IsEnable"] != null && row["IsEnable"].ToString() != "")
         {
             model.IsEnable = int.Parse(row["IsEnable"].ToString());
         }
         if (row["PublishDate"] != null && row["PublishDate"].ToString() != "")
         {
             model.PublishDate = DateTime.Parse(row["PublishDate"].ToString());
         }
         if (row["JobContactName"] != null)
         {
             model.JobContactName = row["JobContactName"].ToString();
         }
         if (row["JobContactAdd"] != null)
         {
             model.JobContactAdd = row["JobContactAdd"].ToString();
         }
         if (row["JobContactPhone"] != null)
         {
             model.JobContactPhone = row["JobContactPhone"].ToString();
         }
         if (row["Other01"] != null)
         {
             model.Other01 = row["Other01"].ToString();
         }
         if (row["Other02"] != null)
         {
             model.Other02 = row["Other02"].ToString();
         }
         if (row["Other03"] != null)
         {
             model.Other03 = row["Other03"].ToString();
         }
     }
     return(model);
 }