コード例 #1
0
        public IActionResult Sort_API()
        {
            //tbname,字段规则
            string orderStr = DataConvert.CStr(RequestEx["orderStr"]).Trim(',');

            if (string.IsNullOrEmpty(orderStr))
            {
                return(Content(Failed.ToString()));
            }
            string[] orderArr = orderStr.Split(',');
            foreach (string item in orderArr)
            {
                int id    = DataConvert.CLng(item.Split(':')[0]);
                int order = DataConvert.CLng(item.Split(':')[1]);
                switch (TbName.ToLower())
                {
                case "commonmodel":
                    DBCenter.UpdateSQL(TableName, "OrderID=" + order, "GeneralID=" + id);
                    break;

                case "product":
                    DBCenter.UpdateSQL(TableName, "OrderID=" + order, "ID=" + id);
                    break;

                case "modelfield":
                    DBCenter.UpdateSQL(TableName, "OrderID=" + order, "FieldID=" + id);
                    break;
                }
            }
            return(Content(Success.ToString()));
        }
コード例 #2
0
        public string Comment_API()
        {
            string action = Request["action"];
            string value  = "";
            string result = "";

            switch (action)
            {
            case "report":    //举报
                value = Request.Form["cid"];
                cmtBll.ReportComment(Convert.ToInt32(value), mu.UserID);
                result = Success.ToString();
                break;

            case "support":    //支持反对操作
                value = Request.Form["flag"];
                bool rflag = true;
                bool flag  = DataConverter.CLng(value) > 0;
                if (buser.GetLogin().IsNull)
                {
                    rflag = cmtBll.Support(Convert.ToInt32(Request.Form["id"]), flag ? 1 : 0, EnviorHelper.GetUserIP());
                }
                else
                {
                    rflag = cmtBll.Support(Convert.ToInt32(Request.Form["id"]), flag ? 1 : 0, EnviorHelper.GetUserIP(), mu.UserID, mu.UserName);
                }
                result = rflag ? Success.ToString() : Failed.ToString();
                break;

            case "assist":    //顶与踩
                bool bl = true;
                if (buser.GetLogin().IsNull)
                {
                    bl = cmtBll.Support(0, Convert.ToInt32(Request.Form["value"]), EnviorHelper.GetUserIP(), Convert.ToInt32(Request.Form["gid"]));
                }
                else
                {
                    bl = cmtBll.Support(0, Convert.ToInt32(Request.Form["value"]), EnviorHelper.GetUserIP(), mu.UserID, mu.UserName, Convert.ToInt32(Request.Form["gid"]));
                }
                result = bl ? "1" : "0";
                break;

            case "reply":    //回复
                result = Comment_Reply();
                break;

            case "sender":    //发送评论
                result = SendComm();
                break;

            default:
                throw new Exception(action + "不存在");
            }
            return(result);
        }
コード例 #3
0
 private void ClearData()
 {
     TotalRecord = 0;
     Complete    = 0;
     Failed      = 0;
     progressBarInsReport.Value   = 0;
     progressBarInsReport.Visible = false;
     lbl_totalrecord.Text         = TotalRecord.ToString();
     lbl_complete.Text            = Complete.ToString();
     lbl_failed.Text = Failed.ToString();
 }
コード例 #4
0
        public override ITelemetry ToTelemetry()
        {
            var eventTelementry = new EventTelemetry {
                Name = GetType().Name
            };

            eventTelementry.Properties["BatchId"]   = BatchId.ToString();
            eventTelementry.Properties["RecordId"]  = RecordId.ToString();
            eventTelementry.Properties["Failed"]    = Failed.ToString();
            eventTelementry.Properties["EventType"] = EventType.ToString();
            eventTelementry.Properties["Message"]   = Message;

            return(eventTelementry);
        }
コード例 #5
0
ファイル: DictController.cs プロジェクト: baixue001/IPS
        public ContentResult DictCate_API()
        {
            string action = GetParam("action");
            string ids    = GetParam("ids");

            switch (action)
            {
            case "del":
                B_DataDicCategory.DelCate(ids);
                break;

            case "use":
                B_DataDicCategory.SetUsedByArr(ids, true);
                break;

            case "unuse":
                B_DataDicCategory.SetUsedByArr(ids, false);
                break;

            case "save":    //新增或修改
            {
                string name = GetParam("name");
                if (string.IsNullOrEmpty(name))
                {
                    return(Content(Failed.ToString()));
                }
                if (Mid > 0)
                {
                    M_DicCategory info = B_DataDicCategory.GetDicCate(Mid);
                    info.CategoryName = name;
                    B_DataDicCategory.Update(info);
                }
                else
                {
                    M_DicCategory info = new M_DicCategory();
                    info.DicCateID    = 0;
                    info.CategoryName = name;
                    info.IsUsed       = true;
                    B_DataDicCategory.AddCate(info);
                }
            }
            break;
            }
            return(Content(Success.ToString()));
        }
コード例 #6
0
ファイル: PubController.cs プロジェクト: baixue001/IPS
        public ContentResult Pub_API()
        {
            string action = RequestEx["action"];
            string ids    = RequestEx["ids"];

            switch (action)
            {
            case "del":
            {
                pubBll.DelByIDS(ids);
            }
            break;

            case "copy":
            {
                int id = DataConvert.CLng(ids);
                if (id < 1)
                {
                    return(Content(Failed.ToString()));
                }
                M_Pub pubMod = pubBll.SelReturnModel(id);
                pubMod.Pubid         = 0;
                pubMod.PubCreateTime = DateTime.Now;
                pubMod.PubName       = pubMod.PubName + "_copy";
                pubBll.insert(pubMod);
            }
            break;

            case "modelname":    //模型名ajax检测
            {
                string name   = DataConverter.CStr(Request.Form["value"]);
                string result = DBHelper.Table_IsExist(B_Pub.PREFIX + name).ToString().ToLower();
                return(Content(result));
                //return "<font color=blue>数据表已存在! 可重复使用!</font>";
                //return "<font color=green>数据表不存在,系统将自动创建!</font>";
            }

            case "recover":
            {
                pubBll.RecyleByIDS(ids, 1);
            }
            break;
            }
            return(Content(Success.ToString()));
        }
コード例 #7
0
        public IActionResult ValidateCode()
        {
            string key = GetParam("key");

            if (string.IsNullOrEmpty(key))
            {
                return(Content(Failed.ToString()));
            }
            if (Request.IsAjax())
            {
                string action = Request.Form["action"];
                string value  = Request.Form["value"];
                string result = "0";
                switch (action)
                {
                case "checkcode":
                    if (value.ToLower().Equals(CMSCodeVerify.CodeDic[key]))
                    {
                        result = "1";
                    }
                    break;

                default:
                    break;
                }
                return(Content(result));
            }
            else
            {
                string randomcode = function.GetRandomString(SiteConfig.SiteOption.VerifyLen, SiteConfig.SiteOption.VerifyForm);
                if (CMSCodeVerify.CodeDic.ContainsKey(key))
                {
                    CMSCodeVerify.CodeDic[key] = randomcode.ToLower();
                }
                else
                {
                    CMSCodeVerify.CodeDic.Add(key, randomcode.ToLower());
                }
                //return File(CreateImage(randomcode).);
                MemoryStream ms = CaptchaCreate.CreateGif(randomcode);
                return(File(ms.ToArray(), "image/gif"));
            }
        }
コード例 #8
0
ファイル: DictController.cs プロジェクト: baixue001/IPS
        public ContentResult GCate_API()
        {
            string action = GetParam("action");
            string ids    = GetParam("ids");

            switch (action)
            {
            case "del":
                gcateBll.DelByIDS(ids);
                break;

            case "save":
            {
                string name   = GetParam("name");
                string alias  = GetParam("alias");
                string remark = GetParam("remark");
                if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(alias))
                {
                    return(Content(Failed.ToString()));
                }
                //int CateID = DataConverter.CLng(this.HdnCateID.Value);
                if (Mid > 0)
                {
                    M_GradeCate info = gcateBll.GetCate(CateID);
                    info.CateID     = CateID;
                    info.CateName   = name;
                    info.Remark     = remark;
                    info.GradeAlias = alias;
                    gcateBll.UpdateCate(info);
                }
                else
                {
                    M_GradeCate info = new M_GradeCate();
                    info.CateName   = name;
                    info.Remark     = remark;
                    info.GradeAlias = alias;
                    gcateBll.AddCate(info);
                }
            }
            break;
            }
            return(Content(Success.ToString()));
        }
コード例 #9
0
ファイル: DictController.cs プロジェクト: baixue001/IPS
        public ContentResult DicItem_API()
        {
            string action = GetParam("action");
            string ids    = GetParam("ids");

            switch (action)
            {
            case "del":
                dItemBll.DelByIds(ids);
                break;

            case "save":
            {
                string name = GetParam("name");
                if (string.IsNullOrEmpty(name))
                {
                    return(Content(Failed.ToString()));
                }
                M_Dictionary info = new M_Dictionary();
                if (Mid > 0)
                {
                    info = B_DataDictionary.GetModel(Mid);
                }
                info.DicName = name;
                if (info.DicID < 1)
                {
                    info.DicCate = CateID;
                    info.IsUsed  = true;
                    B_DataDictionary.AddDic(info);
                }
                else
                {
                    B_DataDictionary.Update(info);
                }
            }
            break;
            }

            return(Content(Success.ToString()));
        }
コード例 #10
0
ファイル: DictController.cs プロジェクト: baixue001/IPS
        public ContentResult GOption_API()
        {
            string action = GetParam("action");
            string ids    = GetParam("ids");

            switch (action)
            {
            case "del":
                gradeBll.DelByIds(ids);
                break;

            case "save":
            {
                string name = GetParam("name");

                if (string.IsNullOrEmpty(name))
                {
                    return(Content(Failed.ToString()));
                }
                if (Mid > 0)
                {
                    M_Grade info = gradeBll.GetGradeOption(Mid);
                    info.GradeName = name;
                    gradeBll.UpdateDic(info);
                }
                else
                {
                    M_Grade info = new M_Grade();
                    info.GradeName = name;
                    info.ParentID  = DataConverter.CLng(RequestEx["ParentID"]);
                    info.Cate      = CateID;
                    info.Grade     = DataConverter.CLng(GetParam("level"));
                    gradeBll.AddGradeOption(info);
                }
                break;
            }
            }
            return(Content(Success.ToString()));
        }
コード例 #11
0
        public ContentResult Store_API()
        {
            string action = GetParam("action");
            string ids    = Request.Form["idchk"];

            if (string.IsNullOrEmpty(ids))
            {
                return(Content(Failed.ToString()));
            }
            string[] idArr = ids.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            foreach (string idStr in idArr)
            {
                int id = Convert.ToInt32(idStr);
                switch (action)
                {
                case "audit":    //批量审核
                    conBll.UpdateStatus(id, (int)ZLEnum.ConStatus.Audited);
                    break;

                case "unaudit":    //取消审核
                    conBll.UpdateStatus(id, (int)ZLEnum.ConStatus.Reject);
                    break;

                case "elite":    //批量推荐
                    conBll.UpdateStatus(id, (int)ZLEnum.ConStatus.Audited);
                    conBll.UpdateElite(idStr, 1);
                    break;

                case "unelite":    //取消推荐
                    conBll.UpdateElite(idStr, 0);
                    break;

                case "del":    //批量删除
                    conBll.DelContent(id);
                    break;
                }
            }
            return(Content(Success.ToString()));
        }
コード例 #12
0
ファイル: IOController.cs プロジェクト: baixue001/IPS
        //上传base64图片
        public IActionResult Base64()
        {
            string     base64str  = Request.Form["base64"];//上传的base64字符串
            string     action     = Request.Form["action"];
            string     uploadPath = "";
            string     saveName   = function.GetRandomString(6) + ".jpg";
            string     result     = "";
            M_UserInfo mu         = buser.GetLogin();

            try
            {
                if (!mu.IsNull)
                {
                    uploadPath = ZLHelper.GetUploadDir_User(mu, "dai");
                }
                else if (adminMod != null)
                {
                    uploadPath = ZLHelper.GetUploadDir_Admin(adminMod, "dai");
                }
                else //Not Login
                {
                    uploadPath = ZLHelper.GetUploadDir_Anony("dai");
                }
                ImgHelper imghelper = new ImgHelper();
                imghelper.Base64ToImg(uploadPath + saveName, base64str);
                result = uploadPath + saveName;
                return(Content(result));
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.fileup, new M_Log()
                {
                    Source  = Request.RawUrl(),
                    Message = "上传失败|文件名:" + uploadPath + saveName + "|" + "原因:" + ex.Message
                });
                return(Content(Failed.ToString()));
            }
        }
コード例 #13
0
ファイル: UserController.cs プロジェクト: baixue001/IPS
        public string Admin_API()
        {
            string action = GetParam("action");
            string ids    = GetParam("ids");

            if (string.IsNullOrEmpty(ids))
            {
                return(Failed.ToString());
            }
            ZoomLa.BLL.SafeSC.CheckIDSEx(ids);
            switch (action)
            {
            case "del":
                foreach (string id in ids.Split(','))
                {
                    B_Admin.DelAdminById(Convert.ToInt32(id));
                }
                break;

            case "lock":
            {
                badmin.LockAdmin(ids, true);
            }
            break;

            case "unlock":
            {
                badmin.LockAdmin(ids, false);
            }
            break;

            default:
                throw new Exception("未指定action");
            }
            return(Success.ToString());
        }
コード例 #14
0
        public IActionResult Order_API()
        {
            if (!B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.shop, "order"))
            {
                return(Content(Failed.ToString()));
            }
            string action = GetParam("a");
            string ids    = GetParam("ids");
            int    Mid    = DataConvert.CLng(GetParam("ids"));

            switch (action)
            {
            case "info_normal":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "恢复正常");
                string        str    = "Aside=0,Suspended=0,Settle=0,BackID=0,OrderStatus=" + (int)M_OrderList.StatusEnum.Normal;
                orderBll.UpOrderinfo(str, Mid); logBll.Insert(logMod);
            }
            break;

            case "info_complete":    //完结订单
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "完结订单");
                //前使用必须修改,只更改状态,不执行FinalStep
                M_OrderList orderMod = oll.SelReturnModel(Mid);
                if (string.IsNullOrEmpty(orderMod.PaymentNo))        //未支付则生成支付单
                {
                    OrderHelper.FinalStep(orderMod);
                }
                else
                {
                    M_Payment payMod = payBll.SelModelByOrder(orderMod);
                    OrderHelper.FinalStep(payMod, orderMod, new M_Order_PayLog());
                }
                logBll.Insert(logMod);
            }
            break;

            case "info_invoce":    //已开发票
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "已开发票");
                oll.UpOrderinfo("Developedvotes=1", Mid); logBll.Insert(logMod);
            }
            break;

            case "info_suspend":    //冻结,挂起订单
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "冻结处理");
                oll.UpOrderinfo("Suspended=1", Mid); logBll.Insert(logMod);
            }
            break;

            case "info_suspend_no":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "取消冻结");
                oll.UpOrderinfo("Suspended=0", Mid); logBll.Insert(logMod);
            }
            break;

            case "info_aside":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "订单作废");
                oll.UpOrderinfo("Aside=1", Mid); logBll.Insert(logMod);
            }
            break;

            case "info_refund":    //退单还款
            {
                M_Order_OPLog logMod    = logBll.NewLog(Mid, "退单还款");
                M_OrderList   orderinfo = oll.GetOrderListByid(Mid);
                if (orderinfo.Paymentstatus == (int)M_OrderList.PayEnum.NoPay)
                {
                    return(WriteErr("操作失败,订单还未支付"));
                }
                if (orderinfo.Paymentstatus == (int)M_OrderList.PayEnum.Refunded)
                {
                    return(WriteErr("操作失败,该订单已退款"));
                }
                buser.ChangeVirtualMoney(orderinfo.Userid, new M_UserExpHis()
                    {
                        score     = orderinfo.Receivablesamount,
                        ScoreType = 1,
                        detail    = "订单[" + orderinfo.id + "]退单返款,返款金额:" + orderinfo.Receivablesamount
                    });
                oll.UpOrderinfo("Paymentstatus=" + (int)M_OrderList.PayEnum.Refunded, Mid); logBll.Insert(logMod);
            }
            break;

            case "info_payed":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "已经支付");
                oll.UpOrderinfo("Paymentstatus=" + (int)M_OrderList.PayEnum.HasPayed, Mid); logBll.Insert(logMod);
            }
            break;

            case "info_pay_cancel":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "取消支付");
                oll.UpOrderinfo("Paymentstatus=" + (int)M_OrderList.PayEnum.NoPay + ",PaymentNo=''", Mid);
                logBll.Insert(logMod);
            }
            break;

            case "info_remind":    //更新备注信息
            {
                M_OrderList orderinfo = oll.SelReturnModel(Mid);
                orderinfo.Internalrecords = GetParam("Internalrecords");
                orderinfo.Ordermessage    = GetParam("Ordermessage");
                oll.UpdateByID(orderinfo);
            }
            break;

            case "exp_cancel":    //取消发送
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "取消发送");
                oll.UpOrderinfo("StateLogistics=" + (int)M_OrderList.ExpEnum.NoSend + ",ExpressNum=''", Mid); logBll.Insert(logMod);
            }
            break;

            case "exp_sign":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "客户已签收");
                oll.UpOrderinfo("Signed=1,StateLogistics=" + (int)M_OrderList.ExpEnum.HasReceived, Mid); logBll.Insert(logMod);
            }
            break;

            //------------------------
            case "sure":    //确认订单
            {
                orderBll.ChangeSure(ids, 1);
                //M_Order_OPLog logMod = logBll.NewLog(Mid, "确认订单");
                //oll.UpOrderinfo("IsSure=1", Mid); logBll.Insert(logMod);
            }
            break;

            case "sure_no":
            {
                orderBll.ChangeSure(ids, 0);
                //M_Order_OPLog logMod = logBll.NewLog(Mid, "取消确认");
                //oll.UpOrderinfo("IsSure=0", Mid); logBll.Insert(logMod);
                //return WriteOK("取消确认成功", "Orderlistinfo?id=" + Mid);
            }
            break;

            case "recycle":    //回收站
            {
                orderBll.ChangeStatus(ids, "recycle");
            }
            break;

            case "recover":
            {
                orderBll.ChangeStatus(ids, "recover");
            }
            break;

            case "del":
            {
                orderBll.DelByIDS(ids);
            }
            break;

            case "clear":
            {
                orderBll.ClearRecycle();
            }
            break;
            }
            return(Content(Success.ToString()));
        }
コード例 #15
0
ファイル: IOController.cs プロジェクト: baixue001/IPS
        public IActionResult UploadFileHandler()
        {
            //HttpRequest Request = context.Request;
            //context.Response.ContentType = "text/plain";
            //context.Request.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
            //context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
            var file = Request.Form.Files["Filedata"];

            if (file == null)
            {
                file = Request.Form.Files["file"];//接受Uploadify或WebUploader传参,优先Uploadify
            }
            if (file == null || file.Length < 1)
            {
                return(Content(Failed.ToString()));
            }
            if (SafeSC.FileNameCheck(file.FileName))
            {
                throw new Exception("不允许上传该后缀名的文件");
            }
            M_UserInfo mu = buser.GetLogin();

            if (adminMod == null && mu.IsNull)
            {
                throw new Exception("未登录");
            }
            /*-------------------------------------------------------------------------------------------*/
            M_User_Plat upMod = new B_User_Plat().SelReturnModel(mu.UserID);
            string      uploadPath = SiteConfig.SiteOption.UploadDir.TrimEnd('/') + "/", filename = "", ppath = "", result = "0";//上传根目录,文件名,上物理路径,结果
            string      action = GetParam("action"), value = GetParam("value");

            try
            {
                switch (action)
                {
                    #region OA与能力中心
                case "OAattach":    //OA--公文||事务--附件
                                    //uploadPath += "OA/" + mu.UserName + mu.UserID + "/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                    uploadPath = ZLHelper.GetUploadDir_User(mu, "OA");
                    ppath      = function.VToP(uploadPath);
                    //判断是否有同名文件的存在
                    break;

                case "Blog":    //能力中心--博客
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Blog);
                    ppath      = function.VToP(uploadPath);
                    break;

                case "Plat_Doc":    //能力中心--我的文档
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Person) + SafeSC.PathDeal(GetParam("Dir"));
                    ppath      = function.VToP(uploadPath);
                    break;

                case "Plat_Doc_Common":    //能力中心--公司文档
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Company) + SafeSC.PathDeal(GetParam("Dir"));
                    ppath      = function.VToP(uploadPath);
                    break;

                case "Plat_Task":    //能力中心--任务中心附件
                    int tid = Convert.ToInt32(value);
                    ZoomLa.Model.Plat.M_Plat_Task taskMod = new B_Plat_Task().SelReturnModel(tid);
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Plat_Task) + taskMod.TaskName + "/";
                    break;

                case "Plat_Project":    //能力中心--项目
                    int pid = Convert.ToInt32(value);
                    ZoomLa.Model.Plat.M_Plat_Pro proMod = new B_Plat_Pro().SelReturnModel(pid);
                    uploadPath = B_Plat_Common.GetDirPath(upMod, B_Plat_Common.SaveType.Plat_Task) + proMod.Name + "/";
                    break;

                    #endregion
                case "ModelFile":    //组图,多图等
                {
                    int nodeid = Convert.ToInt32(value);
                    //M_Node nodeMod = new B_Node().GetNodeXML(nodeid);
                    string exname = Path.GetExtension(file.FileName).Replace(".", "");
                    //string fpath = nodeMod.NodeDir + "/" + exname + "/" + DateTime.Now.ToString("yyyy/MM/");
                    uploadPath = ZLHelper.GetUploadDir_System("field", "images", "yyyyMMdd");
                    filename   = DateTime.Now.ToString("HHmmss") + function.GetRandomString(6, 2) + "." + exname;
                }
                break;

                case "admin_custom":    //管理员上传,自定义路径
                {
                    if (adminMod == null || adminMod.AdminId < 1)
                    {
                        throw new Exception("管理员未登录");
                    }
                    uploadPath = GetParam("save");       //BannerAdd
                }
                break;

                default:    //通常格式,不需做特殊处理的格式但必须登录
                    if (mu.UserID > 0)
                    {
                        //uploadPath = context.Server.UrlDecode(uploadPath + "User/" + mu.UserName + mu.UserID + "/");
                        uploadPath = ZLHelper.GetUploadDir_User(mu, "User", "", "");
                    }
                    else if (adminMod != null)
                    {
                        //uploadPath = context.Server.UrlDecode(uploadPath + "Admin/" + adminMod.AdminName + adminMod.AdminId + "/");
                        uploadPath = ZLHelper.GetUploadDir_Admin(adminMod, "", "", "yyyyMMdd");
                    }
                    else
                    {
                        //注册等页面用户未登录
                        uploadPath = ZLHelper.GetUploadDir_System("user", "register", DateTime.Now.ToString("yyyyMMdd"));
                    }
                    break;
                }
                string uploadDir = Path.GetDirectoryName(function.VToP(uploadPath));
                if (!Directory.Exists(uploadDir))
                {
                    SafeSC.CreateDir(function.PToV(uploadDir));
                }
                if (action.Equals("Plat_Doc") || action.Equals("Plat_Doc_Common"))
                {
                    #region 能力中心文档
                    M_Plat_File fileMod = new M_Plat_File();
                    B_Plat_File fileBll = new B_Plat_File();
                    fileMod.FileName  = file.FileName;
                    fileMod.SFileName = function.GetRandomString(12) + Path.GetExtension(file.FileName);
                    fileMod.VPath     = uploadPath.Replace("//", "/");
                    fileMod.UserID    = upMod.UserID.ToString();
                    fileMod.CompID    = upMod.CompID;
                    //SafeSC.SaveFile(uploadPath, file, fileMod.SFileName);
                    fileMod.FileSize = new FileInfo(ppath + fileMod.SFileName).Length.ToString();
                    fileBll.Insert(fileMod);
                    #endregion
                }
                else if (action.Equals("Cloud_Doc"))
                {
                    #region 用户中心云盘
                    if (!buser.CheckLogin())
                    {
                        throw new Exception("云盘,用户未登录");
                    }
                    M_User_Cloud cloudMod = new M_User_Cloud();
                    B_User_Cloud cloudBll = new B_User_Cloud();
                    uploadPath         = HttpUtility.UrlDecode(cloudBll.H_GetFolderByFType(GetParam("type"), mu)) + GetParam("value");
                    cloudMod.FileName  = file.FileName;
                    cloudMod.SFileName = function.GetRandomString(12) + Path.GetExtension(file.FileName);
                    cloudMod.VPath     = (uploadPath + "/").Replace("//", "/");
                    cloudMod.UserID    = mu.UserID;
                    cloudMod.FileType  = 1;
                    //result = SafeSC.SaveFile(cloudMod.VPath, file, cloudMod.SFileName);
                    //if (SafeSC.IsImage(cloudMod.SFileName))
                    //{
                    //    string icourl = SiteConfig.SiteOption.UploadDir + "YunPan/" + mu.UserName + mu.UserID + "/ico" + value + "/";
                    //    if (!Directory.Exists(function.VToP(icourl))) { SafeSC.CreateDir(icourl); }
                    //    ImgHelper imghelp = new ImgHelper();
                    //    imghelp.CompressImg(file, 100, icourl + cloudMod.SFileName);
                    //}
                    cloudMod.FileSize = new FileInfo(function.VToP(cloudMod.VPath) + cloudMod.SFileName).Length.ToString();
                    cloudBll.Insert(cloudMod);
                    #endregion
                }
                else
                {
                    //string fname = CreateFName(file.FileName);
                    //if (SafeC.IsImageFile(file.FileName) && file.Length > (5 * 1024 * 1024))//图片超过5M则压缩
                    //{
                    //    result = uploadPath + function.GetRandomString(6) + fname;
                    //    new ImgHelper().CompressImg(file, 5 * 1024, result);
                    //}
                    //else
                    //{
                    result = SafeC.SaveFile(uploadPath, filename, file.OpenReadStream(), (int)file.Length);
                    //}
                    //添加水印
                    //if (WaterModuleConfig.WaterConfig.EnableUserWater)
                    //{
                    //    //未以管理员身份登录,并有会员身份登录记录
                    //    if (adminMod == null && !mu.IsNull)
                    //    {
                    //        Image img = WaterImages.DrawFont(ImgHelper.ReadImgToMS(result), mu.UserName + " " + DateTime.Now.ToString("yyyy/MM/dd"), 9);
                    //        ImgHelper.SaveImage(result, img);
                    //    }
                    //}
                    //else if (DataConverter.CStr(context.Request["IsWater"]).Equals("1"))
                    //{
                    //    //前台主动标识需要使用水印
                    //    result = ImgHelper.AddWater(result);
                    //}
                }
                ZLLog.L(ZLEnum.Log.fileup, new M_Log()
                {
                    UName   = mu.UserName,
                    Source  = Request.RawUrl(),
                    Message = "上传成功|文件名:" + file.FileName + "|" + "保存路径:" + uploadPath
                });
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.fileup, new M_Log()
                {
                    UName   = mu.UserName,
                    Source  = Request.RawUrl(),
                    Message = "上传失败|文件名:" + file.FileName + "|" + "原因:" + ex.Message
                });
            }
            return(Content(result));
        }
コード例 #16
0
 private void ReportStatus()
 {
     lbl_complete.Text = Complete.ToString();
     lbl_failed.Text   = Failed.ToString();
 }
コード例 #17
0
        public ContentResult OrderCom()
        {
            M_APIResult retMod = new M_APIResult(M_APIResult.Failed);

            switch (action)
            {
            case "cart_del":
            {
                cartBll.DelByIDS(CartCookID, buser.GetLogin().UserName, ids);
                retMod.retcode = M_APIResult.Success;
            }
            break;

            case "setnum":      //兼容
            case "cart_setnum": //ID,数量,Cookies,可不登录,数量不能小于1
            {
                int id     = DataConverter.CLng(GetParam("id"));
                int pronum = DataConverter.CLng(GetParam("pronum"));
                if (id < 1 || pronum < 1)
                {
                    retMod.retmsg = "商品ID与数量不能小于1";
                }
                else if (string.IsNullOrEmpty(CartCookID))
                {
                    retMod.retmsg = "CartCookID不存在";
                }
                else
                {
                    cartBll.UpdateProNum(CartCookID, mu.UserID, id, pronum);
                    retMod.retcode = M_APIResult.Success;
                }
            }
            break;

            case "deladdress":
            {
                int id = DataConverter.CLng(GetParam("id"));
                if (mu == null || mu.UserID == 0 || id < 1)
                {
                    return(Content(Failed.ToString()));
                }
                else
                {
                    receBll.U_DelByID(id, mu.UserID); return(Content(Success.ToString()));
                }
            }

            case "arrive":
            {
                string    flow   = GetParam("flow");
                double    money  = double.Parse(GetParam("money"));
                DataTable cartdt = cartBll.SelByCartID(CartCookID, mu.UserID, -100, ids);
                if (cartdt.Rows.Count < 1)
                {
                    retMod.retmsg = "购物车为空"; return(Content(retMod.ToString()));
                }
                M_Arrive        avMod  = avBll.SelModelByFlow(flow, mu.UserID);
                M_Arrive_Result arrMod = avBll.U_CheckArrive(avMod, mu.UserID, cartdt, money);
                if (arrMod.enabled)
                {
                    retMod.retcode = M_APIResult.Success;
                    //已优惠金额,优惠后金额
                    retMod.result = Newtonsoft.Json.JsonConvert.SerializeObject(arrMod);
                }
                else
                {
                    retMod.retmsg = arrMod.err;
                }
            }
            break;

            default:
                retMod.retmsg = "[" + action + "]接口不存在";
                break;
            }
            return(Content(retMod.ToString()));
        }
コード例 #18
0
        public string Arrive_API()
        {
            M_Store_Info storeMod = storeBll.SelModelByUser(mu.UserID);
            string       action   = Request.QueryString["action"];
            string       ids      = Request.Form["ids"];

            switch (action)
            {
            case "del":
                //只可删除未被领取的优惠券
            {
                if (string.IsNullOrEmpty(ids))
                {
                    return(Failed.ToString());
                }
                SafeSC.CheckIDSEx(ids);
                string where = "ID IN (" + ids + ") AND StoreID=" + storeMod.ID + " AND UserID=0";
                DBCenter.DelByWhere("ZL_Arrive", where);
            }
            break;

            case "change":
                if (string.IsNullOrEmpty(ids))
                {
                    return(Failed.ToString());
                }
                SafeSC.CheckIDSEx(ids);
                int state = Convert.ToInt32(Request["state"]);
                if (state == 0)
                {
                    //取消激活,只适用于已激活但未被用户领取的优惠券。
                    string where = "ID IN (" + ids + ") AND StoreID=" + storeMod.ID + " AND UserID=0";
                    DBCenter.UpdateSQL("ZL_Arrive", "State=0", where);
                }
                else
                {
                    avBll.UpdateState(ids, state, storeMod.ID);
                }
                break;

            case "bind":
                int uid = Convert.ToInt32(Request["uid"]);
                avBll.GetUpdateUserIdByIDS(ids, uid, storeMod.ID);
                break;

            case "unbind":
            {
                //\\win10\D\Web\办酒网BAK
                if (string.IsNullOrEmpty(ids))
                {
                    return(Failed.ToString());
                }
                SafeSC.CheckIDSEx(ids);
                avBll.GetUpdateUserIdByIDS(ids, 0, storeMod.ID);
            }
            break;

            default:
                return("[" + action + "]未命中");
            }
            return(M_APIResult.Success.ToString());
        }
コード例 #19
0
        public void SerializeAsNUnit(string xmlFile)
        {
            var doc         = new XmlDocument();
            var declaration = doc.CreateXmlDeclaration("1.0", "utf-8", "no");
            var root        = doc.DocumentElement;

            doc.InsertBefore(declaration, root);
            var run = doc.CreateElement(string.Empty, "test-run", string.Empty);

            run.SetAttribute("id", "2"); // Hardcoded for NUnit tests
            run.SetAttribute("name", RunName);
            run.SetAttribute("testcasecount", TestCaseCount.ToString());
            run.SetAttribute("result", Result.ToString());
            run.SetAttribute("time", ((double)((DateTime.Now - StartTime).TotalMilliseconds) / 1000.0).ToString("0.000"));
            run.SetAttribute("total", Total.ToString());
            run.SetAttribute("passed", Passed.ToString());
            run.SetAttribute("failed", Failed.ToString());
            run.SetAttribute("inconclusive", Inconclusive.ToString());
            run.SetAttribute("skipped", Skipped.ToString());
            run.SetAttribute("asserts", "0");
            run.SetAttribute("run-date", StartTime.ToString("yyyy-MM-dd"));
            run.SetAttribute("start-time", StartTime.ToString("hh:mm:ss"));

            doc.AppendChild(run);


            var env = doc.CreateElement(string.Empty, "environment", string.Empty);

            env.SetAttribute("nunit-version", "1.0.0.0");
            run.AppendChild(env);

            foreach (var testSuite in TestSuites.Values)
            {
                var suite = doc.CreateElement(string.Empty, "test-suite", string.Empty);
                suite.SetAttribute("type", "TestSuite");
                suite.SetAttribute("id", testSuite.Id.ToString());
                suite.SetAttribute("name", testSuite.Name);
                suite.SetAttribute("testcasecount", testSuite.TestCaseCount.ToString());
                suite.SetAttribute("total", testSuite.Total.ToString());
                suite.SetAttribute("result", testSuite.Result.ToString());
                suite.SetAttribute("time", ((double)((testSuite.EndTime - testSuite.StartTime).TotalMilliseconds) / 1000.0).ToString("0.000"));
                suite.SetAttribute("passed", testSuite.Passed.ToString());
                suite.SetAttribute("failed", testSuite.Failed.ToString());
                suite.SetAttribute("inconclusive", testSuite.Inconclusive.ToString());
                suite.SetAttribute("skipped", testSuite.Skipped.ToString());
                suite.SetAttribute("asserts", "0");

                run.AppendChild(suite);

                foreach (var testCase in testSuite.TestCases)
                {
                    var tc = doc.CreateElement(string.Empty, "test-case", string.Empty);
                    tc.SetAttribute("id", testCase.Id.ToString());
                    tc.SetAttribute("name", testCase.Name);
                    tc.SetAttribute("result", testCase.Result.ToString());
                    tc.SetAttribute("time", "0.000");
                    tc.SetAttribute("asserts", "0");

                    suite.AppendChild(tc);

                    if (testCase.Properties != null && testCase.Properties.Count > 0)
                    {
                        var props = doc.CreateElement(string.Empty, "properties", string.Empty);
                        tc.AppendChild(props);
                        foreach (var property in testCase.Properties)
                        {
                            var prop = doc.CreateElement(string.Empty, "property", string.Empty);
                            prop.SetAttribute("name", property.Key);
                            prop.SetAttribute("value", property.Value);
                            props.AppendChild(prop);
                        }
                    }

                    if (testCase.Failure != null)
                    {
                        var failure = doc.CreateElement(string.Empty, "failure", string.Empty);
                        tc.AppendChild(failure);
                        if (testCase.Failure.Message != null)
                        {
                            var msg     = doc.CreateElement(string.Empty, "message", string.Empty);
                            var msgData = doc.CreateCDataSection(testCase.Failure.Message);
                            msg.AppendChild(msgData);
                            failure.AppendChild(msg);
                        }
                        if (testCase.Failure.StackTrace != null)
                        {
                            var stck     = doc.CreateElement(string.Empty, "stack-trace", string.Empty);
                            var stckData = doc.CreateCDataSection(testCase.Failure.StackTrace);
                            stck.AppendChild(stckData);
                            failure.AppendChild(stck);
                        }
                    }
                }
            }

            doc.Save(xmlFile);
        }