Ejemplo n.º 1
0
        /// <summary>
        /// 上传图片并获取路径
        /// </summary>
        /// <param name="inputname"></param>
        /// <param name="defaultPic"></param>
        /// <param name="file_extension"></param>
        /// <returns></returns>
        public static string UpFileClass(string inputname, string defaultPic, string file_extension)
        {
            string str_url = string.Empty;

            try
            {
                Common.Globals.UpFileResult _UpFileClass = Common.Globals.Upload(inputname, file_extension);
                if (_UpFileClass.isEmpty || _UpFileClass.returnfilename.Count == 0)
                {
                    if (!string.IsNullOrEmpty(defaultPic.ToString2()))
                    {
                        return(defaultPic);
                    }
                }
                else
                {
                    if (_UpFileClass.returnerror.Count == 0)
                    {
                        str_url = _UpFileClass.returnfilename[0].ToString2();
                    }
                }
            }
            catch
            {
                return(defaultPic);
            }
            return(str_url);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加/编辑
        /// </summary>
        /// <param name="isEdit"></param>
        /// <param name="p_SiteInfo"></param>
        public void AESiteInfo(DealMvc.ControllerBase _CB, bool isEdit, ref Model.SiteInfo p_si)
        {
            Model.SiteInfo m_si = null;

            if (isEdit)
            {
                m_si = DealMvc.Model.SiteInfo.GetModel(p_si.id ?? 0);
            }
            else
            {
                m_si = new Model.SiteInfo();
            }

            if (!isEdit)
            {
                if (Orm.EntityCore <Model.SiteInfo> .Exists("=id", new object[] { p_si.id }))
                {
                    throw new ExceptionEx.MyExceptionMessageBox("已经存在此记录");
                }
            }
            else
            {
            }
            m_si.WebName           = p_si.WebName;                //WebName[Type=string] - 网站名称
            m_si.WebAddress        = p_si.WebAddress;             //WebAddress[Type=string] - 网站域名
            m_si.WebTitle          = p_si.WebTitle;               //WebTitle[Type=string] - 网站标题
            m_si.WebKeyword        = p_si.WebKeyword;             //WebKeyword[Type=string] - 网站关键词
            m_si.WebDelimiter      = p_si.WebDelimiter;           //WebDelimiter[Type=string] - 网站标题分隔符
            m_si.WebCopyright      = p_si.WebCopyright;           //WebCopyright[Type=string] - 版权
            m_si.WebStatus         = p_si.WebStatus;              //WebStatus[Type=bool] - 网站状态(开启网站、关闭网站)
            m_si.WebCloseRemark    = p_si.WebCloseRemark;         //WebCloseRemark[Type=string] - 关闭网站原因
            m_si.WebCompetence     = p_si.WebCompetence;          //WebCompetence[Type=bool] - 网站后台权限
            m_si.IsOpenDataCache   = p_si.IsOpenDataCache;        //IsOpenDataCache[Type=bool] - 数据缓存  是否启用
            m_si.DataCacheTime     = p_si.DataCacheTime ?? 0;     //DataCacheTime[Type= int?] - 缓存时间(秒)
            m_si.ProportionMention = p_si.ProportionMention ?? 0; //ProportionMention[Type=double?] - 平台提拥比例
            m_si.WebBottomInfo     = p_si.WebBottomInfo;          //WebBottomInfo[Type=string] - 网站底部信息

            //WebFriendLinks[Type=string] - 友情链接
            Common.Globals.UpFileResult _UpFileResult = Common.Globals.Upload("WebFriendLinks");
            if (_UpFileResult.returnerror.Count == 0)
            {
                if (_UpFileResult.returnfilename.Count > 0)
                {
                    m_si.WebFriendLinks = _UpFileResult.returnfilename[0].ToString();
                }
            }
            else
            {
                throw new ExceptionEx.MyExceptionMessageBox(string.Join("<br/>", (string[])_UpFileResult.returnerror.ToArray(typeof(string))));
            }


            m_si.WebBottomContact = p_si.WebBottomContact;  //WebBottomContact[Type=string] - 底部联系方式
            m_si.WebBottomHours   = p_si.WebBottomHours;    //WebBottomHours[Type=string] - 营业时间
            m_si.WebRegService    = p_si.WebRegService;     //WebRegService[Type=string] - 注册条款
            //m_si.WebWeiXinImage = p_si.WebWeiXinImage;        //WebWeiXinImage[Type=string] - 微信二维码图片
            Common.Globals.UpFileResult _UpFileResultWebWeiXinImage = Common.Globals.Upload("WebWeiXinImage");
            if (_UpFileResultWebWeiXinImage.returnerror.Count == 0)
            {
                if (_UpFileResultWebWeiXinImage.returnfilename.Count > 0)
                {
                    m_si.WebWeiXinImage = _UpFileResultWebWeiXinImage.returnfilename[0].ToString();
                }
            }
            else
            {
                throw new ExceptionEx.MyExceptionMessageBox(string.Join("<br/>", (string[])_UpFileResultWebWeiXinImage.returnerror.ToArray(typeof(string))));
            }

            //m_si.WebWeiBoImage = p_si.WebWeiBoImage;        //WebWeiBoImage[Type=string] - 微博二维码图片
            Common.Globals.UpFileResult _UpFileResultWebWeiBoImage = Common.Globals.Upload("WebWeiBoImage");
            if (_UpFileResultWebWeiBoImage.returnerror.Count == 0)
            {
                if (_UpFileResultWebWeiBoImage.returnfilename.Count > 0)
                {
                    m_si.WebWeiBoImage = _UpFileResultWebWeiBoImage.returnfilename[0].ToString();
                }
            }
            else
            {
                throw new ExceptionEx.MyExceptionMessageBox(string.Join("<br/>", (string[])_UpFileResultWebWeiBoImage.returnerror.ToArray(typeof(string))));
            }
            m_si.WebContactPhone = p_si.WebContactPhone; //WebContactPhone[Type=string] - 联系电话
            m_si.WebContactEmail = p_si.WebContactEmail; //WebContactEmail[Type=string] - 联系邮箱
            m_si.KeFuQQ          = p_si.KeFuQQ;          //KeFuQQ[Type=string] - 客服QQ
            m_si.BeforeSalePhone = p_si.BeforeSalePhone; //BeforeSalePhone[Type=string] - 售前电话
            m_si.AfterSalePhone  = p_si.AfterSalePhone;  //AfterSalePhone[Type=string] - 售后电话

            p_si = m_si;
            if (isEdit)
            {
                m_si.Update();
                ExceptionEx.MyExceptionLog.AlertMessage(_CB, "修改网站基本信息成功");
                _CB.IsSaveForm = true;
            }
            else
            {
                m_si.Add();
                ExceptionEx.MyExceptionLog.AlertMessage(_CB, "添加成功", true);
            }
        }