private void FillMailChiiBranchIDmp()
    {
        LPWeb.Model.Branches model = new LPWeb.Model.Branches();
        model = bllB.GetModel(iBranchID);

        cbEnableMailChimp.Checked = model.EnableMailChimp;

        txbMCKey.Text = model.MailChimpAPIKey;

        if (cbEnableMailChimp.Checked)
        {
            txbMCKey.Enabled = true;

            if (!string.IsNullOrEmpty(model.MailChimpAPIKey))
            {
                btnSync.Disabled = false;
            }
            else
            {
                btnSync.Disabled = true;
            }
        }
        else
        {
            txbMCKey.Enabled = false;
            btnSync.Disabled = true;
        }
    }
示例#2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.Branches> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.Branches> modelList = new List <LPWeb.Model.Branches>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.Branches model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.Branches();
                    if (dt.Rows[n]["BranchId"].ToString() != "")
                    {
                        model.BranchId = int.Parse(dt.Rows[n]["BranchId"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    model.Desc = dt.Rows[n]["Desc"].ToString();
                    if (dt.Rows[n]["Enabled"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Enabled"].ToString() == "1") || (dt.Rows[n]["Enabled"].ToString().ToLower() == "true"))
                        {
                            model.Enabled = true;
                        }
                        else
                        {
                            model.Enabled = false;
                        }
                    }
                    if (dt.Rows[n]["RegionID"].ToString() != "")
                    {
                        model.RegionID = int.Parse(dt.Rows[n]["RegionID"].ToString());
                    }
                    if (dt.Rows[n]["DivisionID"].ToString() != "")
                    {
                        model.DivisionID = int.Parse(dt.Rows[n]["DivisionID"].ToString());
                    }
                    if (dt.Rows[n]["GroupID"].ToString() != "")
                    {
                        model.GroupID = int.Parse(dt.Rows[n]["GroupID"].ToString());
                    }
                    model.BranchAddress = dt.Rows[n]["BranchAddress"].ToString();
                    model.City          = dt.Rows[n]["City"].ToString();
                    model.BranchState   = dt.Rows[n]["BranchState"].ToString();
                    model.Zip           = dt.Rows[n]["Zip"].ToString();
                    if (dt.Rows[n]["WebsiteLogo"].ToString() != "")
                    {
                        model.WebsiteLogo = (byte[])dt.Rows[n]["WebsiteLogo"];
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Request.QueryString["BranchID"] != null) // 如果有GroupID
        {
            string sBranchID           = this.Request.QueryString["BranchID"].ToString();
            LPWeb.Model.Branches model = new LPWeb.Model.Branches();
            try
            {
                this.iBranchID = Convert.ToInt32(sBranchID);

                model = branchManager.GetModel(iBranchID);

                //Response.ContentType = getreader["markType"] as string;
                //Response.ContentType = "image/jpeg";
                //Response.OutputStream.Write(model.WebsiteLogo, 0, model.WebsiteLogo.Length);
                //("width:330px; height:64px");

                if (model.WebsiteLogo == null)
                {
                    return;
                }

                int iWidth  = 330;
                int iHeight = 90;

                ImageConverter       imc  = new ImageConverter();
                System.Drawing.Image _img = imc.ConvertFrom(null, null, model.WebsiteLogo) as System.Drawing.Image;

                int iOrgWidth  = Convert.ToInt32(_img.Width);
                int iOrgHeight = Convert.ToInt32(_img.Height);

                ResizeImg(iOrgWidth, iOrgHeight, ref iWidth, ref iHeight);

                Bitmap   _Bitmap   = new Bitmap(iWidth, iHeight);
                Graphics _Graphcis = Graphics.FromImage(_Bitmap);
                _Graphcis.DrawImage(System.Drawing.Image.FromStream(new MemoryStream(model.WebsiteLogo)), 0, 0, iWidth, iHeight);
                _Graphcis.Dispose();

                MemoryStream ms = new MemoryStream();
                _Bitmap.Save(ms, ImageFormat.Png);
                ms.Flush();
                byte[] bData = ms.GetBuffer();
                ms.Close();

                Response.BinaryWrite(bData);
                Response.End();
            }
            catch
            { }
        }
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Request.QueryString["BranchID"] != null) // 如果有GroupID
        {
            string sBranchID           = this.Request.QueryString["BranchID"].ToString();
            LPWeb.Model.Branches model = new LPWeb.Model.Branches();
            try
            {
                this.iBranchID = Convert.ToInt32(sBranchID);

                model = branchManager.GetModel(iBranchID);
                //Response.ContentType = getreader["markType"] as string;
                Response.ContentType = "image/jpeg";
                Response.OutputStream.Write(model.WebsiteLogo, 0, model.WebsiteLogo.Length);
                Response.End();
            }
            catch
            { }
        }
    }
    protected void btnSaveMailChimp_Click(object sender, EventArgs e)
    {
        try
        {
            if (iBranchID == 0)
            {
                return;
            }

            LPWeb.Model.Branches model = new LPWeb.Model.Branches();
            model.BranchId        = iBranchID;
            model.EnableMailChimp = cbEnableMailChimp.Checked;
            model.MailChimpAPIKey = txbMCKey.Text.Trim();

            bllB.UpdateChimpAPIKey(model);
            FillMailChiiBranchIDmp();
            PageCommon.AlertMsg(this, "Save successfully.");
        }
        catch (Exception ex)
        {
            LPLog.LogMessage(ex.Message);
            PageCommon.AlertMsg(this, "Failed to save the record ,Error:" + ex.Message);
        }
    }
示例#6
0
 /// <summary>
 /// UpdateChimpAPIKey
 /// </summary>
 public void UpdateChimpAPIKey(LPWeb.Model.Branches model)
 {
     dal.UpdateChimpAPIKey(model);
 }
示例#7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LPWeb.Model.Branches model)
 {
     dal.Update(model);
 }
示例#8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(LPWeb.Model.Branches model)
 {
     return(dal.Add(model));
 }
示例#9
0
 /// <summary>
 /// 保存Branch和Members信息
 /// </summary>
 /// <param name="iGroupID"></param>
 /// <param name="bEnabled"></param>
 /// <param name="sGroupDesc"></param>
 /// <param name="sOldGroupMemberIDs"></param>
 /// <param name="sGroupMemberIDs"></param>
 public void SaveBranchAndMembersBase(LPWeb.Model.Branches model, string sFolderIDs, string sManagers)
 {
     dal.SaveBranchAndMembersBase(model, sFolderIDs, sManagers);
 }