Exemplo n.º 1
0
        public ActionResult SoftwareUploadClick(string version, string type, string plistUrl)
        {
            var result          = new DirectResult();
            var fileUploadField = this.GetCmp <FileUploadField>("fileUploadField");

            if (fileUploadField.HasFile)
            {
                try
                {
                    string postedFileName = GetPostedFileName(fileUploadField.PostedFile.FileName);
                    postedFileName = ChinesePinYin.GetPinYin(postedFileName);
                    var    documentAttachment = new DocumentAttachment(GetFilePath(type, GetSoftwareBaseFolder()));
                    string filePath           = documentAttachment.GetFileName(postedFileName);
                    string url = GetUrl(type, GetSoftwareMuLu(), postedFileName);
                    fileUploadField.PostedFile.SaveAs(filePath);
                    SaveSoftwareFilePathToDbstring(version, type, url, plistUrl);
                    X.Msg.Show(MessageBoxConfig(Success, TiShi, MessageBox.Icon.INFO));
                }
                catch (Exception ex)
                {
                    X.Msg.Show(MessageBoxConfig(ex.ToString(), Fail, MessageBox.Icon.INFO));
                }
                finally
                {
                    PushMessageToTag(type.ToLower(), version, "all", 1, -1, string.Empty, string.Empty, 0);
                }
            }
            else
            {
                result.IsUpload = true;
                X.Msg.Show(MessageBoxConfig(NoFile, TiShi, MessageBox.Icon.ERROR));
            }
            return(result);
        }
Exemplo n.º 2
0
        public ActionResult DocumentUploadClick(string title, string areaPath, string documentType, string releaseDate)
        {
            log4net.LogManager.GetLogger("DocumentUploadClick").InfoFormat("推送周刊数据【{0}】-【{1}】-【{2}】-【{3}】", title, areaPath, documentType, releaseDate);
            var limitClick = Session["DocumentUploadClick"] as DateTime?;

            if (limitClick.HasValue)
            {
                if ((DateTime.Now - limitClick.Value).TotalMinutes < 1)
                {
                    X.Msg.Show(MessageBoxConfig("不允许一分钟内重复发布周刊", TiShi, MessageBox.Icon.ERROR));
                    return(this.Direct());
                }
            }
            var result = new DirectResult();

            var    fileUploadField = this.GetCmp <FileUploadField>("fileUploadField");
            var    xingZhengQuYu   = GetCity(areaPath);
            string shi             = xingZhengQuYu.Description;

            if (fileUploadField.HasFile)
            {
                try
                {
                    string postedFileName = GetPostedFileName(fileUploadField.PostedFile.FileName);
                    postedFileName = ChinesePinYin.GetPinYin(postedFileName);
                    string type = ChinesePinYin.GetPinYin(documentType);
                    var    documentAttachment = new DocumentAttachment(GetFilePath(ChinesePinYin.GetPinYin(shi), type, GetDocumentBaseFolder()));
                    string filePath           = documentAttachment.GetFileName(postedFileName);
                    string url = GetUrl(ChinesePinYin.GetPinYin(shi), type, GetDocumentMuLu(), postedFileName);
                    fileUploadField.PostedFile.SaveAs(filePath);
                    SaveDocumentFilePathToDbstring(title, shi, postedFileName, fileUploadField.PostedFile.ContentType, documentType, releaseDate, filePath, url, areaPath);

                    switch (documentType)
                    {
                    case MsgInfo.ZhouKan:
                    case MsgInfo.ZhiDiFenXi:
                        //PushMessageToTag2(title, shi, 2, shi, documentType, xingZhengQuYu.Id);
                        PushMessageToTag2(title, shi, 2, shi, MsgInfo.ZhiDiFenXi, xingZhengQuYu.Id);
                        break;

                    case MsgInfo.TuDiGuaPai:
                    case MsgInfo.DiChanShaLong:
                    case MsgInfo.ZiChanChuZhi:
                        PushMessageToTag2(title, "all", 2, shi, documentType, xingZhengQuYu.Id);
                        break;
                    }
                    X.Msg.Show(MessageBoxConfig(Success, TiShi, MessageBox.Icon.INFO));
                }
                catch
                (Exception ex)
                {
                    X.Msg.Show(MessageBoxConfig(ex.ToString(), Fail, MessageBox.Icon.INFO));
                }
            }
            else
            {
                result.IsUpload = true;
                X.Msg.Show(MessageBoxConfig(NoFile, TiShi, MessageBox.Icon.ERROR));
            }
            return(result);
        }