Exemple #1
0
 public void AddEx(string Content, EnumHelper.ReferType Type, int TargetId, string CreateNickName = "")
 {
     Maticsoft.Model.SNS.ReferUsers model = new Maticsoft.Model.SNS.ReferUsers();
     Users users2 = new Users();
     if (!string.IsNullOrWhiteSpace(Content))
     {
         MatchCollection matchs = Regex.Matches(Content, @"@[\u4e00-\u9fa5\w\-]+");
         List<string> list = new List<string>();
         if (!string.IsNullOrEmpty(CreateNickName))
         {
             list.Add(CreateNickName);
         }
         foreach (Match match in matchs)
         {
             int num;
             string item = match.Value.Trim(new char[] { '@' });
             if ((!list.Contains(item) && !string.IsNullOrEmpty(item)) && ((num = users2.GetUserIdByNickName(item)) > 0))
             {
                 list.Add(item);
                 model.CreatedDate = DateTime.Now;
                 model.IsRead = false;
                 model.ReferUserID = num;
                 model.ReferNickName = item;
                 model.Type = (int) Type;
                 model.TagetID = TargetId;
                 this.Add(model);
             }
         }
     }
 }
 /// <summary>
 /// 获取消息枚举对应的微信平台接受的消息名称
 /// </summary>
 public static string ObtainMessageType(EnumHelper.MsgType type)
 {
     var mi = type.GetType().GetMember(Enum.GetName(type.GetType(), type)).FirstOrDefault();
     MsgTypeAttribute attr = null;
     if (mi != null)
     {
         attr =
             mi.GetCustomAttributes(typeof(MsgTypeAttribute), true).FirstOrDefault() as MsgTypeAttribute;
     }
     return attr == null ? null : ObtainMessageType(attr);
 }
Exemple #3
0
 public void SaveImageFile(EnumHelper.photoDestination photoDestination, string baseFolder,string filename, Pracownice.Models.Pracownica pracownica)
 {
     if (photoDestination == EnumHelper.photoDestination.mainPhoto)
     {
         ChangeMainPhoto(pracownica,baseFolder, filename);
     }
     else if (photoDestination == EnumHelper.photoDestination.galleryPhoto)
     {
         AddPhotoGallery(pracownica, baseFolder, filename);
     }
     else
     {
         throw new Exception("Problem with Saving File || DbHelperUtils");
     }
 }
 public static void Bind(RadioButtonList rdolst, ListItemCollection list, EnumHelper.ListItemType listType)
 {
     foreach (ListItem item in list)
     {
         //if (listType == EnumHelper.ListItemType.CommissionType)
         //{
         //    if (Convert.ToInt32(item.Value) == Convert.ToInt32(EnumHelper.CommissionType.Dollar))
         //    {
         //        item.Text = "$";
         //    }
         //    if (Convert.ToInt32(item.Value) == Convert.ToInt32(EnumHelper.CommissionType.Percentage))
         //    {
         //        item.Text = "%";
         //    }
         //}
         rdolst.Items.Add(item);
     }
 }
    /// <summary>
    /// Import mapping from Excel file. Create the corresponding XML files
    /// </summary>
    /// <param name="mappingType">Mapping type - > Codelist | IUS | Medatata</param>
    /// <param name="paramString">Param string</param>
    /// <remarks>Param string should be in the format of DBNID[****]LangauageCode[****]UserNId[****]AgeCodeListGID[****]SexCodeListGId[****]LocationCodeListGID</remarks>
    public string ImportMapppingFile(EnumHelper.MappingType mappingType, string paramValue, string languageCode, string dbNId, string fileName)
    {
        //Load Excel mapping file
        string RetVal = string.Empty;
        DIExcel ExportExcel = new DIExcel(fileName);
        this.languageCode = languageCode;
        this.dbNId = dbNId;

        switch (mappingType)
        {
            case EnumHelper.MappingType.CodeList:
                RetVal = this.ImportCodeListMappingData(ExportExcel, paramValue).ToString().ToLower();
                break;
            case EnumHelper.MappingType.IUS:
                RetVal = this.ImportIUSMappingData(ExportExcel, paramValue).ToString().ToLower();
                break;
            case EnumHelper.MappingType.Metadata:
                RetVal = this.ImportMetadataMappingData(ExportExcel, paramValue).ToString().ToLower();
                break;
            default:
                break;
        }
        return RetVal;
    }
Exemple #6
0
 public ActionResult Dialog()
 {
     ViewBag.LocalType = EnumHelper.GetOptions <ELocalType>(0);
     ViewBag.Storage   = DropDownHelper.GetStorage(this.DefaultStorageNum, this.CompanyID);
     return(View());
 }
Exemple #7
0
        private void FrmMain_Load(Object sender, EventArgs e)
        {
            var log = TextFileLog.Create(null, "Net_{0:yyyy_MM_dd}.log");

            BizLog = txtReceive.Combine(log);
            txtReceive.UseWinFormControl();

            txtReceive.SetDefaultStyle(12);
            txtSend.SetDefaultStyle(12);
            numMutilSend.SetDefaultStyle(12);

            gbReceive.Tag = gbReceive.Text;
            gbSend.Tag    = gbSend.Text;

            _task.ContinueWith(t =>
            {
                var dic  = EnumHelper.GetDescriptions <WorkModes>();
                var list = dic.Select(kv => kv.Value).ToList();
                //var ds = dic.ToDictionary(s => s.Value, s => s.Value);
                foreach (var item in t.Result)
                {
                    list.Add(item.Key);
                }
                this.Invoke(() =>
                {
                    cbMode.DataSource = list;

                    var cfg = NetConfig.Current;
                    if (cfg.Mode > 0 && dic.ContainsKey((WorkModes)cfg.Mode))
                    {
                        cbMode.SelectedItem = dic[(WorkModes)cfg.Mode];
                    }
                    else
                    {
                        cbMode.SelectedIndex = 0;
                    }
                });
            });

            // 加载保存的颜色
            UIConfig.Apply(txtReceive);

            LoadConfig();

            // 语音识别
            Task.Factory.StartNew(() =>
            {
                var sp = SpeechRecognition.Current;
                if (!sp.Enable)
                {
                    return;
                }

                sp.Register("打开", () => this.Invoke(Connect))
                .Register("关闭", () => this.Invoke(Disconnect))
                .Register("退出", () => Application.Exit())
                .Register("发送", () => this.Invoke(() => btnSend_Click(null, null)));

                BizLog.Info("语音识别前缀:{0} 可用命令:{1}", sp.Name, sp.GetAllKeys().Join());
            });
        }
Exemple #8
0
        public async Task <IActionResult> Statuses()
        {
            await Task.CompletedTask;

            return(Ok(EnumHelper.List <AssigmentStatus>()));
        }
Exemple #9
0
 public bool UpdateRecommand(int ablumId, EnumHelper.RecommendType recommendType)
 {
     return this.dal.UpdateRecommand(ablumId, recommendType);
 }
Exemple #10
0
 public Axis AddNewAxis()
 {
     return((from axisType in EnumHelper.AllValuesFor <AxisTypes>()
             where !_axes.Contains(axisType)
             select AddNewAxisFor(axisType)).FirstOrDefault());
 }
Exemple #11
0
 public bool UpdateStatusList(string IdsStr, EnumHelper.GroupStatus status)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("update SNS_Groups set Status=" + ((int) status) + " ");
     builder.Append(" where GroupID in (" + IdsStr + ")  ");
     return (DbHelperSQL.ExecuteSql(builder.ToString()) > 0);
 }
Exemple #12
0
        private void GetV4PlusStyleGridView(DataGridView dataGridView)
        {
            //dataGridView.AutoGenerateColumns = false;
            V4PlusFile subtitleFile = mSubtitleFile as V4PlusFile;

            EnumHelper<V4PlusStyleHeader> styleHelper = new EnumHelper<V4PlusStyleHeader>();
            Dictionary<V4PlusStyleHeader, string> enumDictionary = styleHelper.GetEnumsWithDescriptions();

            //DataGridViewColumnCollection columns = new DataGridViewColumnCollection(dataGridView);
            //dataGridView.Columns.Clear();

            //foreach (string styleDescription in enumDictionary.Values)
            //{
            //    DataGridViewColumn column = new DataGridViewColumn();
            //    column.HeaderText = styleDescription;
            //    dataGridView.Columns.Add(column);
            //}

            BindingList<IV4PlusStyle> rows = new BindingList<IV4PlusStyle>();
            rows.AddingNew += new AddingNewEventHandler(subtitleFile.AddingNewStyle);

            IList<IV4PlusStyle> styleValues = subtitleFile.GetStyles();
            foreach(IV4PlusStyle value in styleValues)
            {
                rows.Add(value);
            }

            dataGridView.DataSource = rows;
        }
 public string GetAsOutput()
 {
     EnumHelper<V4PlusScriptInfoHeader> helper = new EnumHelper<V4PlusScriptInfoHeader>();
     string description = helper.GetDescriptionFromEnum(mParameter);
     return description + ": " + mValue;
 }
Exemple #14
0
        public List<Maticsoft.ViewModel.SNS.Posts> GetPostByType(int UserId, int StartIndex, int EndIndex, EnumHelper.PostType Type, int PostId, bool includeProduct = true)
        {
            List<Maticsoft.Model.SNS.Posts> list = new List<Maticsoft.Model.SNS.Posts>();
            List<Maticsoft.Model.SNS.Posts> modelList = new List<Maticsoft.Model.SNS.Posts>();
            Dictionary<int, Maticsoft.Model.SNS.Posts> dictionary = new Dictionary<int, Maticsoft.Model.SNS.Posts>();
            List<Maticsoft.ViewModel.SNS.Posts> list3 = new List<Maticsoft.ViewModel.SNS.Posts>();
            string strWhere = "";
            string str2 = "";
            switch (Type)
            {
                case EnumHelper.PostType.All:
                    strWhere = " Status=" + 1;
                    break;

                case EnumHelper.PostType.Fellow:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId in (SELECT  PassiveUserID  FROM  SNS_UserShip WHERE  ActiveUserID=", UserId, " UNION SELECT ", UserId, ")" });
                    break;

                case EnumHelper.PostType.User:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId });
                    break;

                case EnumHelper.PostType.OnePost:
                    strWhere = " PostID=" + PostId;
                    break;

                case EnumHelper.PostType.ReferMe:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and PostID in (SELECT  TagetID FROM SNS_ReferUsers  WHERE  ReferUserID=", UserId, " and Type=0)" });
                    break;

                case EnumHelper.PostType.EachOther:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId in ( SELECT PassiveUserID  FROM  dbo.SNS_UserShip WHERE  ActiveUserID=", UserId, " and Type=1)" });
                    break;

                case EnumHelper.PostType.Photo:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId, " and Type=", 1 });
                    break;

                case EnumHelper.PostType.Product:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId, " and Type=", 2 });
                    break;

                case EnumHelper.PostType.Video:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId, " and VideoUrl is not null" });
                    break;

                case EnumHelper.PostType.Blog:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId, " and Type=", 4 });
                    break;

                default:
                    strWhere = "Status=" + 1;
                    break;
            }
            if (!includeProduct)
            {
                strWhere = strWhere + " and Type<>" + 2;
            }
            list = this.DataTableToList(this.GetListByPage(strWhere, "PostId Desc", StartIndex, EndIndex).Tables[0]);
            int[] values = (from item in list
                where item.OriginalID != 0
                select item.OriginalID).Distinct<int>().ToArray<int>();
            string str3 = string.Join<int>(",", values);
            if (!string.IsNullOrEmpty(str3))
            {
                str2 = "PostId in(" + str3 + ")";
                modelList = this.GetModelList(str2);
            }
            foreach (Maticsoft.Model.SNS.Posts posts in modelList)
            {
                dictionary.Add(posts.PostID, posts);
            }
            foreach (Maticsoft.Model.SNS.Posts posts2 in list)
            {
                Maticsoft.ViewModel.SNS.Posts posts3 = new Maticsoft.ViewModel.SNS.Posts();
                posts2.Description = ViewModelBase.RegexNickName(posts2.Description);
                posts3.Post = posts2;
                if (dictionary.ContainsKey(posts2.OriginalID))
                {
                    posts3.OrigPost = dictionary[posts2.OriginalID];
                    posts3.OrigPost.Description = ViewModelBase.RegexNickName(posts3.OrigPost.Description);
                }
                list3.Add(posts3);
            }
            if (Type == EnumHelper.PostType.ReferMe)
            {
                new Maticsoft.BLL.SNS.ReferUsers().UpdateReferStateToRead(UserId, 0);
            }
            return list3;
        }
Exemple #15
0
 public List<Maticsoft.Model.SNS.Posts> GetScrollPost(int top, EnumHelper.PostContentType PostType)
 {
     DataSet set = new DataSet();
     if (PostType == EnumHelper.PostContentType.None)
     {
         set = this.GetList(top, " ", "CreatedDate Desc");
     }
     else
     {
         set = this.GetList(top, "Type=" + ((int) PostType), " CreatedDate Desc");
     }
     return this.DataTableToList(set.Tables[0]);
 }
Exemple #16
0
 public List<Maticsoft.ViewModel.SNS.Posts> GetPostByType(int UserId, int StartIndex, int EndIndex, EnumHelper.PostType Type, bool includeProduct = true)
 {
     return this.GetPostByType(UserId, StartIndex, EndIndex, Type, 0, includeProduct);
 }
Exemple #17
0
        public int GetCountByPostType(int UserId, EnumHelper.PostType PostType, bool includeProduct)
        {
            string strWhere = "";
            switch (PostType)
            {
                case EnumHelper.PostType.All:
                    strWhere = " Status=" + 1;
                    break;

                case EnumHelper.PostType.Fellow:
                    strWhere = string.Concat(new object[] { "Status=", 1, " and CreatedUserId in ( SELECT  PassiveUserID  FROM  SNS_UserShip WHERE  ActiveUserID=", UserId, " UNION SELECT ", UserId, ")" });
                    break;

                case EnumHelper.PostType.User:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId });
                    break;

                case EnumHelper.PostType.ReferMe:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and PostID in (SELECT  TagetID FROM SNS_ReferUsers  WHERE  ReferUserID=", UserId, " and Type=0)" });
                    break;

                case EnumHelper.PostType.EachOther:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId in (SELECT PassiveUserID  FROM SNS_UserShip WHERE  ActiveUserID=", UserId, " and Type=1)" });
                    break;

                case EnumHelper.PostType.Photo:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId, " and Type=", 1 });
                    break;

                case EnumHelper.PostType.Product:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId, " and Type=", 2 });
                    break;

                case EnumHelper.PostType.Video:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId, " and VideoUrl is not null" });
                    break;

                case EnumHelper.PostType.Blog:
                    strWhere = string.Concat(new object[] { " Status=", 1, " and CreatedUserId=", UserId, " and Type=", 4 });
                    break;

                default:
                    strWhere = "";
                    break;
            }
            if (!includeProduct)
            {
                strWhere = strWhere + " and Type<>" + 2;
            }
            return this.GetRecordCount(strWhere);
        }
Exemple #18
0
 private bool DoRoundTrip(EnumHelper<UserStatus> enumHelper, UserStatus status)
 {
     return enumHelper.Names.Contains(Enum.GetName(typeof(UserStatus), status));
 }
Exemple #19
0
        public IActionResult Index(long mid)
        {
            if (!this.HasMenu(mid))
            {
                return(this.GetResult(false, "无菜单访问权限!"));
            }
            var model = new MenuModel()
            {
                MenuTreeUrl    = this.GetUrl("menus/list"),
                MenuModeuleUrl = this.GetUrl("menus/module"),
                InfoUrl        = this.GetUrl("menus/info"),
                OrderUrl       = this.GetUrl("menus/order"),
                DelUrl         = this.GetUrl("menus/del"),
                GetFieldsUrl   = this.GetUrl("menus/getfields"),
                FieldTypes     = EnumHelper.ToList <MenuFieldType>().Select(a => new JsonData <string>()
                {
                    id = a.ToString(), text = a.GetDescription()
                }).ToList(),
                MenuTypes = EnumHelper.ToJsonData <MenuType>()
            };

            ViewBag.SubmitUrl = this.GetUrl("menus/save");

            using (var db = this.GetMongodb())
            {
                #region 当前用户菜单列表
                var menus = this.AppUser.Menus;
                model.Menus = db.Menus.Where(a => menus.Contains(a.Id)).ToList();
                #endregion

                #region 加载MenuFlags
                model.Flags = EnumHelper.ToList <MenuFlag>().Select(a => new JsonData <int>()
                {
                    id = (int)a, text = a.GetDescription()
                }).ToList();
                #endregion

                #region 加载常用模块
                model.Modules = db.MenuModules.ToList();
                if (model.Modules.Count == 0)
                {
                    model.Modules.Add(new MenuModule()
                    {
                        Id    = 1,
                        Name  = "文章模块",
                        Url   = "Article",
                        Model = "Article"
                    });
                    model.Modules.Add(new MenuModule()
                    {
                        Id    = 2,
                        Name  = "图文链接",
                        Url   = "Link",
                        Model = "Link"
                    });
                    model.Modules.Add(new MenuModule()
                    {
                        Id    = 3,
                        Name  = "数据字典",
                        Url   = "Code",
                        Model = "Code"
                    });
                    db.MenuModules.AddMany(model.Modules);
                }
                #endregion
            }
            return(View(model));
        }
Exemple #20
0
        /// <summary>
        /// Save file 
        /// </summary>
        /// <param name="file"></param>
        /// <param name="server"></param>
        /// <param name="pracownica"></param>
        /// <param name="destination"></param>
        /// <returns></returns>
        public static bool SaveFile(HttpPostedFileBase file,HttpServerUtilityBase server, Pracownice.Models.Pracownica pracownica, EnumHelper.photoDestination destination )
        {
            if(ValidateImageFile(file))
            {
                //create file
                var fileName = pracownica.Name + rand.Next(0,999999) + "_" +  file.FileName;

                string folderPath;

                if(destination == EnumHelper.photoDestination.mainPhoto)
                {
                    folderPath = MyConfig.mainPhotoUrl;
                }
                else if (destination == EnumHelper.photoDestination.galleryPhoto)
                {
                    folderPath = MyConfig.mainPhotoUrl;
                }
                else
                {
                    throw new Exception("Problem with Config File || SaveFile");
                }

                //gets path
                var path = Path.Combine(server.MapPath(folderPath), fileName);

                try
                {
                    file.SaveAs(path);
                    dbHelper.SaveImageFile(destination,folderPath, fileName, pracownica);

                    //Creteate Thumb
                    CreateThumb(folderPath, fileName, server);
                }
                catch (Exception e)
                {
                    return false;
                }
            }
            else
            {
                return false;
            }

            return true;
        }
Exemple #21
0
 public List <KeyValuePair <int, string> > GetAllBloodTypes()
 {
     return(EnumHelper <BloodType> .GetItems().ToList());
 }
 public void Alert(EnumHelper.Alerts alertType, string message)
 {
     TempData[alertType.ToString()] = message;
 }
Exemple #23
0
        public ActionResult T(int id = 0, string type = "")
        {
            Constants.Novel.PromotionType promotionType = Constants.Novel.PromotionType.none;
            string url = "";

            if (id > 0)
            {
                if (EnumHelper.TryParsebyName <Constants.Novel.PromotionType>(type, out promotionType))
                {
                    if (promotionType == Constants.Novel.PromotionType.pmc)
                    {
                        PromotionLink promotionLink = _promotionLinkService.Detail(id);
                        if (promotionLink != null && promotionLink.Id > 0 &&
                            !string.IsNullOrEmpty(promotionLink.ChannelCode) &&
                            !string.IsNullOrEmpty(promotionLink.PromotionCode))
                        {
                            SetSessionHeaderInfoFromRoute(promotionLink.ChannelCode, promotionLink.PromotionCode);

                            string chapterUrl  = "/chapter/detail/".GetChannelRouteUrl(promotionLink.ChannelCode);
                            int    chapterCode = promotionLink.EndChapterCode > promotionLink.StartChapterCode ? promotionLink.EndChapterCode : 0;

                            if (promotionLink.FuncType == 1)
                            {
                                IDictionary <string, object> dict = new Dictionary <string, object>();
                                dict.Add("c", ChapterContext.GetRangeToken(promotionLink.EndChapterCode, promotionLink.FollowChapter));
                                dict.Add("rp", ChapterContext.GetReplyText(promotionLink.ReplyKeywords));
                                chapterUrl = "/preview".GetChannelRouteUrl(promotionLink.ChannelCode).SpliceUrl(dict);
                            }

                            url = ChapterContext.GetUrl(chapterUrl, promotionLink.NovelId, chapterCode, Constants.Novel.ChapterDirection.none, channelId: RouteChannelId);
                        }
                    }
                    else if (promotionType == Constants.Novel.PromotionType.rk)
                    {
                        PromotionLink promotionLink = _promotionLinkService.Detail(id);
                        if (promotionLink != null && promotionLink.Id > 0 &&
                            !string.IsNullOrEmpty(promotionLink.ChannelCode) &&
                            !string.IsNullOrEmpty(promotionLink.PromotionCode))
                        {
                            SetSessionHeaderInfoFromRoute(promotionLink.ChannelCode, promotionLink.PromotionCode);

                            string chapterUrl = "/chapter/detail/".GetChannelRouteUrl(promotionLink.ChannelCode);

                            url = ChapterContext.GetUrl(chapterUrl, promotionLink.NovelId, promotionLink.FollowChapter, Constants.Novel.ChapterDirection.none, channelId: RouteChannelId);
                        }
                    }
                }
                else
                {
                    NovelPromotionChannel model = _novelPromotionChannelService.Detail(id);
                    if (model != null && model.NovelId > 0 && model.ChapterCode >= 0)
                    {
                        string chapterUrl = "chapter/detail";
                        string channelId  = model.ChannelId;

                        if (!string.IsNullOrEmpty(channelId))
                        {
                            chapterUrl = string.Concat(chapterUrl, "?channelid=", channelId);
                        }
                        url = ChapterContext.GetUrl(chapterUrl, model.NovelId, model.ChapterCode, channelId: RouteChannelId);
                    }
                }
            }

            if (string.IsNullOrEmpty(url))
            {
                url = DataContext.GetErrorUrl(channelId: RouteChannelId);
            }

            return(Redirect(url));
        }
Exemple #24
0
 public List<Maticsoft.Model.SNS.GroupTopics> GetUserRelativeTopicByType(int UserId, EnumHelper.UserGroupType Type, int StartIndex, int EndIndex)
 {
     new List<Maticsoft.Model.SNS.GroupTopics>();
     string whereByType = this.GetWhereByType(UserId, Type);
     return this.DataTableToList(this.GetListByPage(whereByType, "CreatedDate Desc", StartIndex, EndIndex).Tables[0]);
 }
Exemple #25
0
        public string GetWhereByStatus(EnumHelper.OrderMainStatus orderType)
        {
            switch (orderType)
            {
                case EnumHelper.OrderMainStatus.Paying:
                    return string.Format(" OrderStatus={0}  and PaymentStatus={1} and ShippingStatus={2} and PaymentGateway!='{3}'", new object[] { 0, 0, 0, EnumHelper.PaymentGateway.cod.ToString() });

                case EnumHelper.OrderMainStatus.PreHandle:
                    return string.Format(" OrderStatus={0}  and PaymentStatus={1} and ShippingStatus={2} and PaymentGateway='{3}'", new object[] { 0, 0, 0, EnumHelper.PaymentGateway.cod.ToString() });

                case EnumHelper.OrderMainStatus.Cancel:
                    return string.Format(" OrderStatus={0}  and PaymentStatus={1} and ShippingStatus={2} ", -1, 0, 0);

                case EnumHelper.OrderMainStatus.Locking:
                    return string.Format("  PaymentStatus={1} and ShippingStatus={2}  and (OrderStatus={0} or OrderStatus={3})  ", new object[] { -3, 0, 0, -2 });

                case EnumHelper.OrderMainStatus.PreConfirm:
                    return string.Format(" OrderStatus={0}  and PaymentStatus={1} and ShippingStatus={2} and PaymentGateway!='{3}'", new object[] { 0, 2, 0, EnumHelper.PaymentGateway.bank.ToString() });

                case EnumHelper.OrderMainStatus.Handling:
                    return string.Format(" OrderStatus={0}  and ShippingStatus={1} ", 1, 0);

                case EnumHelper.OrderMainStatus.Shipping:
                    return string.Format(" OrderStatus={0}  and  ShippingStatus={1}", 1, 1);

                case EnumHelper.OrderMainStatus.Shiped:
                    return string.Format(" OrderStatus={0}  and  ShippingStatus={1}", 1, 2);

                case EnumHelper.OrderMainStatus.Complete:
                    return string.Format(" OrderStatus={0}  and  ShippingStatus={1}", 2, 3);
            }
            return "";
        }
Exemple #26
0
        public string GetWhereByType(int UserId, EnumHelper.UserGroupType Type)
        {
            string str = "GroupID in(select GroupID from SNS_GroupUsers where UserID=" + UserId + ")";
            switch (Type)
            {
                case EnumHelper.UserGroupType.UserGroup:
                    return ("GroupID in(select GroupID from SNS_GroupUsers where UserID=" + UserId + ")");

                case EnumHelper.UserGroupType.UserPostTopic:
                    return ("CreatedUserID=" + UserId);

                case EnumHelper.UserGroupType.UserReply:
                    return ("TopicID in (SELECT DISTINCT TopicID FROM SNS_GroupTopicReply WHERE  ReplyUserID=" + UserId + ")");

                case EnumHelper.UserGroupType.UserFav:
                    return ("TopicID in(select TopicID from SNS_GroupTopicFav where CreatedUserID=" + UserId + ")");
            }
            return str;
        }
Exemple #27
0
 public static List<Maticsoft.Model.Ms.ThumbnailSize> GetThumSizeList(EnumHelper.AreaType type, string Theme = "")
 {
     string cacheKey = "GetThumSizeList-" + ((int) type) + Theme;
     object cache = DataCache.GetCache(cacheKey);
     if (cache == null)
     {
         Maticsoft.BLL.Ms.ThumbnailSize size = new Maticsoft.BLL.Ms.ThumbnailSize();
         try
         {
             string strWhere = " Type=" + ((int) type);
             if (!string.IsNullOrWhiteSpace(Theme))
             {
                 strWhere = strWhere + " and (Theme='" + Theme + "' or Theme='')";
             }
             cache = size.GetModelList(strWhere);
             if (cache != null)
             {
                 int num = Globals.SafeInt(ConfigSystem.GetValueByCache("ModelCache"), 30);
                 DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) num), TimeSpan.Zero);
             }
         }
         catch
         {
         }
     }
     return (List<Maticsoft.Model.Ms.ThumbnailSize>) cache;
 }
Exemple #28
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            if (ObjectId != Guid.Empty)
            {
                var request = DataManager.Request.SelectById(SiteId, ObjectId);
                if (request != null)
                {
                    CheckReadAccess(request.OwnerID, "Requests");

                    Title             =
                        lrlTitle.Text =
                            string.Format("Запрос №{0} от {1}", request.Number,
                                          request.CreatedAt.ToString("dd.MM.yyyy"));
                    lrlStatus.Text = string.Format("Состояние: {0}",
                                                   EnumHelper.GetEnumDescription((RequestStatus)request.RequestStatusID));

                    lrlShortDescription.Text = string.Format("<div class='text-container'>{0}</div>", request.ShortDescription);
                    lrlLongDescription.Text  = string.Format("<div class='text-container'>{0}</div>", request.LongDescription);

                    if (request.ContactID.HasValue)
                    {
                        var contact = DataManager.Contact.SelectById(SiteId, (Guid)request.ContactID);
                        if (contact != null)
                        {
                            lrlContact.Text = contact.UserFullName;
                        }
                    }

                    if (request.ResponsibleID.HasValue)
                    {
                        var responsible = DataManager.Contact.SelectById(SiteId, (Guid)request.ResponsibleID);
                        if (responsible != null)
                        {
                            lrlResponsible.Text = responsible.UserFullName;
                        }
                    }

                    if (request.ReactionDateActual.HasValue)
                    {
                        lrlReactionDateActual.Text = request.ReactionDateActual.Value.ToString("dd.MM.yyyy hh:mm");
                    }

                    if (request.ReactionDatePlanned.HasValue)
                    {
                        lrlReactionDatePlanned.Text = request.ReactionDatePlanned.Value.ToString("dd.MM.yyyy hh:mm");
                    }

                    if (request.RequestSourceID.HasValue && request.RequestSourceTypeID.HasValue)
                    {
                        UpdateRequestSourceFiles((Guid)request.RequestSourceID, (Guid)request.RequestSourceTypeID);
                    }

                    var requestFiles = DataManager.RequestFile.SelectByRequestId(request.ID);
                    if (requestFiles.Any())
                    {
                        var fsp = new FileSystemProvider();
                        var sb  = new StringBuilder();
                        foreach (var requestFile in requestFiles)
                        {
                            sb.Append(string.Format("<a href='{0}' target='_blank'>{1}</a> ",
                                                    fsp.GetLink(SiteId, "Requests", requestFile.FileName,
                                                                FileType.Attachment),
                                                    requestFile.FileName));
                        }

                        lrlRequestFiles.Text = sb.ToString();
                    }
                }
            }
        }
Exemple #29
0
 public List<Maticsoft.Model.SNS.Groups> GetGroupListByRecommendType(int Top, EnumHelper.GroupRecommend Type)
 {
     return this.DataTableToList(this.GetListByPage("IsRecommand=" + ((int) Type), "", 0, Top).Tables[0]);
 }
 /// <summary>
 ///   Called by clients to authenticate the server and optionally the client in a client-server connection.
 /// </summary>
 /// <param name="targetHost">The name of the server</param>
 /// <param name="port">The port of the server</param>
 /// <param name="protocol">The protocol used to communicate with the server</param>
 /// <param name="clientCertificates">The X509CertificateCollection that contains client certificates.</param>
 /// <param name="enabledSslProtocols">The SslProtocols value that represents the protocol used for authentication.</param>
 /// <param name="checkCertificateRevocation">
 ///   A Boolean value that specifies whether the certificate revocation list is
 ///   checked during authentication.
 /// </param>
 public void AuthenticateAsClient(string targetHost, int port, ProtocolType protocol = ProtocolType.Tcp, X509CertificateCollection clientCertificates = null, SslProtocols enabledSslProtocols = SslProtocols.Default, bool checkCertificateRevocation = false)
 {
     _tlsaRecords = _resolver.ResolveSecure <TlsaRecord>(DomainName.Parse("_" + port + "._" + EnumHelper <ProtocolType> .ToString(protocol).ToLower() + "." + targetHost), RecordType.Tlsa);
     _sslStream.AuthenticateAsClient(targetHost, clientCertificates ?? new X509CertificateCollection(), enabledSslProtocols, checkCertificateRevocation);
 }
Exemple #31
0
        public async Task <IActionResult> PriorityDegree()
        {
            await Task.CompletedTask;

            return(Ok(EnumHelper.List <PriorityDegree>().OrderByDescending(x => x.Id)));
        }
        /// <summary>
        ///   Called by clients to authenticate the server and optionally the client in a client-server connection.
        /// </summary>
        /// <param name="targetHost">The name of the server</param>
        /// <param name="port">The port of the server</param>
        /// <param name="protocol">The protocol used to communicate with the server</param>
        /// <param name="clientCertificates">The X509CertificateCollection that contains client certificates.</param>
        /// <param name="enabledSslProtocols">The SslProtocols value that represents the protocol used for authentication.</param>
        /// <param name="checkCertificateRevocation">
        ///   A Boolean value that specifies whether the certificate revocation list is
        ///   checked during authentication.
        /// </param>
        public async Task AuthenticateAsClientAsync(string targetHost, int port, ProtocolType protocol = ProtocolType.Tcp, X509CertificateCollection clientCertificates = null, SslProtocols enabledSslProtocols =
#if NETSTANDARD
                                                    SslProtocols.Tls,
#else
                                                    SslProtocols.Default,
#endif
                                                    bool checkCertificateRevocation = false)
        {
            _tlsaRecords = await _resolver.ResolveSecureAsync <TlsaRecord>(DomainName.Parse("_" + port + "._" + EnumHelper <ProtocolType> .ToString(protocol).ToLower() + "." + targetHost), RecordType.Tlsa);

            await _sslStream.AuthenticateAsClientAsync(targetHost, clientCertificates ?? new X509CertificateCollection(), enabledSslProtocols, checkCertificateRevocation);
        }
Exemple #33
0
 public List <SelectListItem> GetSortByOptions(MediaCategorySearchModel searchModel)
 {
     return(EnumHelper <MediaCategorySortMethod> .GetOptions());
 }
Exemple #34
0
        public DataFlowOpInitializeResult Initialize(DataFlowOpInitializateContext context)
        {
            if (!context.OutputPorts.IsEmpty())
            {
                throw new ArgumentException("LogSink operator does not provide an output stream");
            }

            _dataflowName       = context.DataflowName;
            _dataFlowInstanceId = context.DataflowInstanceId;

            _shellPerStream = new EventBeanSPI[context.InputPorts.Count];
            foreach (KeyValuePair <int, DataFlowOpInputPort> entry in context.InputPorts)
            {
                EventType eventType = entry.Value.TypeDesc.EventType;
                if (eventType != null)
                {
                    _shellPerStream[entry.Key] = context.StatementContext.EventAdapterService.GetShellForType(eventType);
                }
            }

            if (format == null)
            {
                _renderer = new ConsoleOpRendererSummary();
            }
            else
            {
                try
                {
                    var formatEnum = EnumHelper.Parse <LogSinkOutputFormat>(format.Trim());
                    if (formatEnum == LogSinkOutputFormat.summary)
                    {
                        _renderer = new ConsoleOpRendererSummary();
                    }
                    else
                    {
                        _renderer = new ConsoleOpRendererXmlJSon(formatEnum, context.Engine.EPRuntime);
                    }
                }
                catch (Exception ex)
                {
                    throw new ExprValidationException("Format '" + format + "' is not supported, expecting any of " + EnumHelper.GetValues <LogSinkOutputFormat>().Render());
                }
            }

            return(null);
        }
Exemple #35
0
        public WasteCodesViewModel SetAnnexMessagesAndData(int annexNumber)
        {
            var a            = new List <AnnexTableWasteCodes>();
            var annexMessage = "See Annex " + annexNumber;

            if (Basel.Length > BaselLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.Basel), Basel));
                Basel = annexMessage;
            }

            if (Oecd.Length > OecdLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.Oecd), Oecd));
                Oecd = annexMessage;
            }

            if (Ewc.Length > EwcLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.Ewc), Ewc));
                Ewc = annexMessage;
            }

            if (Nce.Length > NceLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.ExportCode), Nce));
                Nce = annexMessage;
            }

            if (Nci.Length > NciLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.ImportCode), Nci));
                Nci = annexMessage;
            }

            if (Other.Length > OtherLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.OtherCode), Other));
                Other = annexMessage;
            }

            if (Y.Length > YLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.Y), Y));
                Y = annexMessage;
            }

            if (H.Length > HLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.H), H));
                H = annexMessage;
            }

            if (UnClass.Length > UnClassLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.Un), UnClass));
                UnClass = annexMessage;
            }

            if (UnNumber.Length > UnNumberLength || UnShippingName.Length > UnShippingNameLength)
            {
                a.Add(AddToAnnexTableWasteCodes("UN Number and Shipping name", UnNumberAndShippingName));
                UnNumber       = annexMessage;
                UnShippingName = annexMessage;
            }

            if (Customs.Length > CustomsLength)
            {
                a.Add(AddToAnnexTableWasteCodes(EnumHelper.GetDisplayName(CodeType.CustomsCode), Customs));
                Customs = annexMessage;
            }

            AnnexTableWasteCodes = a;

            return(this);
        }
Exemple #36
0
 public AccessView(AccessCache package)
 {
     Login    = package.Login;
     Password = package.Password;
     State    = TranslateState(EnumHelper.GetValue <AccessState>(package.State));
 }
Exemple #37
0
        public JsonResult Edit(GiftViewModel model)
        {
            var result = new AjaxReturnData {
                success = false, msg = "未知错误"
            };

            if (ModelState.IsValid)
            {
                GiftViewModel postdata = new GiftViewModel();
                if (model.Id > 0)
                {
                    GiftInfo dbdata = _iGiftService.GetByIdAsNoTracking(model.Id);
                    //数据补充
                    if (dbdata == null)
                    {
                        result.success = false;
                        result.msg     = "编号有误";
                        return(Json(result));
                    }
                    postdata = dbdata.Map <GiftViewModel>();
                }
                else
                {
                    if (model.StockQuantity < 1)
                    {
                        result.success = false;
                        result.msg     = "库存必须大于0";
                        return(Json(result));
                    }
                }
                // UpdateModel(postdata);
                GiftInfo data = new GiftInfo();
                data = postdata.Map <GiftInfo>();
                if (model.Id > 0)
                {
                    _iGiftService.UpdateGift(data);
                }
                else
                {
                    data.Sequence    = 100;
                    data.AddDate     = DateTime.Now;
                    data.SalesStatus = GiftInfo.GiftSalesStatus.Normal;
                    _iGiftService.AddGift(data);
                }

                #region 转移图片
                int           index   = 1;
                List <string> piclist = new List <string>();

                piclist.Add(model.PicUrl1);
                piclist.Add(model.PicUrl2);
                piclist.Add(model.PicUrl3);
                piclist.Add(model.PicUrl4);
                piclist.Add(model.PicUrl5);

                string path = data.ImagePath;
                foreach (var item in piclist)
                {
                    if (!string.IsNullOrWhiteSpace(item))
                    {
                        string source = string.Empty;

                        if (item.IndexOf("temp/") > 0)
                        {
                            source = item.Substring(item.LastIndexOf("/temp"));
                        }
                        else if (item.Contains(data.ImagePath))
                        {
                            source = item.Substring(item.LastIndexOf(data.ImagePath));
                        }

                        try
                        {
                            string dest = string.Format("{0}/{1}.png", path, index);
                            if (source == dest)
                            {
                                index++;
                                continue;
                            }
                            if (!string.IsNullOrWhiteSpace(source))
                            {
                                Core.MallIO.CopyFile(source, dest, true);
                            }
                            var imageSizes = EnumHelper.ToDictionary <ImageSize>().Select(t => t.Key);

                            foreach (var imageSize in imageSizes)
                            {
                                string size = string.Format("{0}/{1}_{2}.png", path, index, imageSize);
                                Core.MallIO.CreateThumbnail(dest, size, imageSize, imageSize);
                            }

                            //using (Image image = Image.FromFile(source))
                            //{

                            //    image.Save(dest, System.Drawing.Imaging.ImageFormat.Png);

                            //    var imageSizes = EnumHelper.ToDictionary<GiftInfo.ImageSize>().Select(t => t.Key);
                            //    foreach (var imageSize in imageSizes)
                            //    {
                            //        string size = string.Format("{0}/{1}_{2}.png", path, index, imageSize);
                            //        ImageHelper.CreateThumbnail(dest, size, imageSize, imageSize);
                            //    }

                            //}
                            index++;
                        }
                        catch (FileNotFoundException fex)
                        {
                            index++;
                            Core.Log.Error("发布礼品时候,没有找到文件", fex);
                        }
                        catch (System.Runtime.InteropServices.ExternalException eex)
                        {
                            index++;
                            Core.Log.Error("发布礼品时候,ExternalException异常", eex);
                        }
                        catch (Exception ex)
                        {
                            index++;
                            Core.Log.Error("发布礼品时候,Exception异常", ex);
                        }
                    }
                    else
                    {
                        string dest = string.Format("{0}/{1}.png", path, index);
                        if (MallIO.ExistFile(dest))
                        {
                            MallIO.DeleteFile(dest);
                        }

                        var imageSizes = EnumHelper.ToDictionary <ImageSize>().Select(t => t.Key);
                        foreach (var imageSize in imageSizes)
                        {
                            string size = string.Format("{0}/{1}_{2}.png", path, index, imageSize);
                            if (MallIO.ExistFile(size))
                            {
                                MallIO.DeleteFile(size);
                            }
                        }
                        index++;
                    }
                }

                #endregion

                result.success = true;
                result.msg     = "操作成功";
            }
            else
            {
                result.success = false;
                result.msg     = "数据有误";
            }

            return(Json(result));
        }
Exemple #38
0
        public static string RepairJdOrder(string jdPorderId)
        {
            var commodityorderfacade = new Jinher.AMP.BTP.IBP.Facade.CommodityOrderFacade();

            commodityorderfacade.ContextDTO = AuthorizeHelper.CoinInitAuthorizeInfo();
            var jdorderitemfacade = new Jinher.AMP.BTP.IBP.Facade.JdOrderItemFacade();

            jdorderitemfacade.ContextDTO = AuthorizeHelper.CoinInitAuthorizeInfo();
            var jdjournalfacade = new Jinher.AMP.BTP.IBP.Facade.JdJournalFacade();

            jdjournalfacade.ContextDTO = AuthorizeHelper.CoinInitAuthorizeInfo();

            //开始拆单
            JdOrderItemDTO model = new JdOrderItemDTO();

            model.JdPorderId = jdPorderId;
            model.State      = 1;//
            //获取jdorderitem表中的数据
            var jdorderitem = jdorderitemfacade.GetJdOrderItemList(model).FirstOrDefault();

            if (jdorderitem != null)
            {
                var  getFullOrderInfo = commodityorderfacade.GetFullOrderInfoById(jdorderitem.CommodityOrderId);
                bool flag             = JdHelper.IsjdOrder(jdPorderId);
                if (flag == true)
                {
                    #region 父订单拆单行为
                    var selectJdOrder2 = JdHelper.selectJdOrder2(jdPorderId);
                    if (!string.IsNullOrWhiteSpace(selectJdOrder2))
                    {
                        List <string> list = new List <string>();
                        list.Add(jdPorderId);
                        //删除已有的父类订单
                        var delresult = jdorderitemfacade.DeleteJdOrderItem(list);
                        if (delresult.isSuccess == true)
                        {
                            JArray objson = JArray.Parse(selectJdOrder2);
                            foreach (var item in objson)
                            {
                                JArray objsku = JArray.Parse(item["sku"].ToString());
                                foreach (var ZiJdOrder in objsku)
                                {
                                    #region 子订单包含包含多个商品的情况
                                    string skuId  = ZiJdOrder["skuId"].ToString();
                                    Guid   TempId = Guid.Empty;
                                    Guid   commodityOrderItemId = Guid.Empty;
                                    if (getFullOrderInfo.OrderItems != null && getFullOrderInfo.OrderItems.Count() > 0)
                                    {
                                        var commoditydto = getFullOrderInfo.OrderItems.Where(p => p.JdCode == skuId).FirstOrDefault();
                                        if (commoditydto != null)
                                        {
                                            commodityOrderItemId = commoditydto.Id;
                                            TempId = commoditydto.CommodityId;
                                        }
                                    }
                                    int    State        = Convert.ToInt32(JdEnum.BCF);
                                    string StateContent = new EnumHelper().GetDescription(JdEnum.BCF);
                                    string JdOrderId    = item["jdOrderId"].ToString();
                                    string Name         = "京东下订单" + StateContent;
                                    string Details      = "订单状态由" + jdorderitem.State + "变成" + State;
                                    if (item["orderState"].ToString() == "0")
                                    {
                                        State        = Convert.ToInt32(JdEnum.BCF);
                                        StateContent = new EnumHelper().GetDescription(JdEnum.BCF);
                                        Name         = "京东下订单" + StateContent;
                                        Details      = "订单状态由" + jdorderitem.State + "变成" + State;
                                    }
                                    JdOrderItemDTO jdorderitemdto = new JdOrderItemDTO()
                                    {
                                        Id                   = Guid.NewGuid(),
                                        JdPorderId           = jdPorderId,
                                        TempId               = TempId,
                                        JdOrderId            = JdOrderId,
                                        MainOrderId          = jdorderitem.MainOrderId,
                                        CommodityOrderId     = jdorderitem.CommodityOrderId,
                                        State                = State,
                                        StateContent         = StateContent,
                                        SubTime              = DateTime.Now,
                                        ModifiedOn           = DateTime.Now,
                                        CommoditySkuId       = skuId,
                                        CommodityOrderItemId = commodityOrderItemId
                                    };
                                    var restult = jdorderitemfacade.SaveJdOrderItem(jdorderitemdto);
                                    if (restult.isSuccess == true)
                                    {
                                        JdJournalDTO ex = new JdJournalDTO()
                                        {
                                            JdPorderId       = jdPorderId,
                                            TempId           = TempId,
                                            JdOrderId        = JdOrderId,
                                            MainOrderId      = jdorderitem.MainOrderId,
                                            CommodityOrderId = jdorderitem.CommodityOrderId,
                                            Name             = Name,
                                            Details          = StateContent
                                        };
                                        var res = jdjournalfacade.GetJdJournalList(ex);
                                        if (res.Count() == 0)
                                        {
                                            JdJournalDTO jdjournaldto = new JdJournalDTO()
                                            {
                                                Id               = Guid.NewGuid(),
                                                JdPorderId       = jdPorderId,
                                                TempId           = TempId,
                                                JdOrderId        = JdOrderId,
                                                MainOrderId      = jdorderitem.MainOrderId,
                                                CommodityOrderId = jdorderitem.CommodityOrderId,
                                                Name             = Name,
                                                Details          = StateContent,
                                                SubTime          = DateTime.Now
                                            };
                                            jdjournalfacade.SaveJdJournal(jdjournaldto);
                                        }
                                    }
                                    #endregion
                                }
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    #region  拆单行为
                    var selectJdOrder1 = JdHelper.selectJdOrder1(jdPorderId);
                    if (!string.IsNullOrWhiteSpace(selectJdOrder1))
                    {
                        JObject objs   = JObject.Parse(selectJdOrder1);
                        JArray  objson = JArray.Parse(objs["sku"].ToString());
                        foreach (var ZiJdOrder in objson)
                        {
                            #region 子订单包含包含多个商品的情况
                            string skuId  = ZiJdOrder["skuId"].ToString();
                            Guid   TempId = Guid.Empty;
                            Guid   commodityOrderItemId = Guid.Empty;
                            if (getFullOrderInfo.OrderItems != null && getFullOrderInfo.OrderItems.Count() > 0)
                            {
                                var commoditydto = getFullOrderInfo.OrderItems.Where(p => p.JdCode == skuId).FirstOrDefault();
                                if (commoditydto != null)
                                {
                                    commodityOrderItemId = commoditydto.Id;
                                    TempId = commoditydto.CommodityId;
                                }
                            }
                            int    State        = Convert.ToInt32(JdEnum.BCF);
                            string StateContent = new EnumHelper().GetDescription(JdEnum.BCF);
                            string JdOrderId    = objs["jdOrderId"].ToString();
                            string Name         = "京东下订单" + StateContent;
                            string Details      = "订单状态由" + jdorderitem.State + "变成" + State;
                            jdorderitem.TempId               = TempId;
                            jdorderitem.JdOrderId            = JdOrderId;
                            jdorderitem.State                = State;
                            jdorderitem.StateContent         = StateContent;
                            jdorderitem.CommoditySkuId       = skuId;
                            jdorderitem.CommodityOrderItemId = commodityOrderItemId;
                            var restult = jdorderitemfacade.UpdateJdOrderItem(jdorderitem);
                            if (restult.isSuccess == true)
                            {
                                JdJournalDTO ex = new JdJournalDTO()
                                {
                                    JdPorderId       = jdPorderId,
                                    TempId           = TempId,
                                    JdOrderId        = JdOrderId,
                                    MainOrderId      = jdorderitem.MainOrderId,
                                    CommodityOrderId = jdorderitem.CommodityOrderId,
                                    Name             = Name,
                                    Details          = StateContent
                                };
                                var res = jdjournalfacade.GetJdJournalList(ex);
                                if (res.Count() == 0)
                                {
                                    JdJournalDTO jdjournaldto = new JdJournalDTO()
                                    {
                                        Id               = Guid.NewGuid(),
                                        JdPorderId       = jdPorderId,
                                        TempId           = TempId,
                                        JdOrderId        = JdOrderId,
                                        MainOrderId      = jdorderitem.MainOrderId,
                                        CommodityOrderId = jdorderitem.CommodityOrderId,
                                        Name             = Name,
                                        Details          = StateContent,
                                        SubTime          = DateTime.Now
                                    };
                                    jdjournalfacade.SaveJdJournal(jdjournaldto);
                                }
                            }
                            #endregion
                        }
                    }
                    #endregion
                }

                #region 更新订单信息状态
                Jinher.AMP.BTP.Deploy.CommodityOrderDTO commodity = new Jinher.AMP.BTP.Deploy.CommodityOrderDTO();
                commodity.Id            = Guid.Parse(jdorderitem.CommodityOrderId);
                commodity.State         = 2;
                commodity.ShipmentsTime = DateTime.Now;
                //更新订单状态
                commodityorderfacade.UpdateCommodityOrder(commodity);
                #endregion

                return("ok");
            }
            return("no found");
        }
Exemple #39
0
 public static Object[] GetPrototypeOA()
 {
     return(new Object[EnumHelper.CountValues <ExpressionViewOAFieldEnum>()]);
 }
Exemple #40
0
 public override string Class() => EnumHelper <Constants.Classes> .GetDisplayValue(Constants.Classes.Druid);
        public NotificationOptionsViewModel(Guid notificationId, NotificationMovementsSummaryAndTable data)
        {
            NotificationId         = notificationId;
            NotificationNumber     = data.SummaryData.NotificationNumber;
            NotificationType       = data.NotificationType;
            IntendedShipments      = data.TotalIntendedShipments;
            UsedShipments          = data.SummaryData.ShipmentsUsed;
            QuantityRemainingTotal = data.SummaryData.QuantityRemaining.ToString("G29") + " " + EnumHelper.GetDisplayName(data.SummaryData.DisplayUnit);
            QuantityReceivedTotal  = data.SummaryData.QuantityReceived.ToString("G29") + " " + EnumHelper.GetDisplayName(data.SummaryData.DisplayUnit);
            ActiveLoadsPermitted   = data.SummaryData.ActiveLoadsPermitted;
            ActiveLoadsCurrent     = data.SummaryData.CurrentActiveLoads;

            CompetentAuthority       = data.SummaryData.CompetentAuthority;
            NotificationStatus       = data.SummaryData.NotificationStatus;
            FinancialGuaranteeStatus = data.SummaryData.FinancialGuaranteeStatus;
            IsInterimNotification    = data.IsInterimNotification;

            TableData = new List <ShipmentDatesTableViewModel>(
                data.ShipmentTableData.OrderByDescending(m => m.Number)
                .Select(p => new ShipmentDatesTableViewModel(p)));

            PageSize          = data.PageSize;
            PageNumber        = data.PageNumber;
            NumberofShipments = data.NumberOfShipments;
        }
Exemple #42
0
 public JsonResult GetShippingStatuses() => new JsonResult(EnumHelper <ShippingStatus> .ToJson());
Exemple #43
0
        private async Task <Response> CreateUser()
        {
            Analytics.TrackEventAsync(Category.UserManagement, Action.Create, "Created User", Username, CookieHelper.GetAnalyticClientId(Cookies));
            var body = Request.Body.AsString();

            if (string.IsNullOrEmpty(body))
            {
                return(Response.AsJson(new JsonResponseModel {
                    Result = false, Message = "Could not save user, invalid JSON body"
                }));
            }

            var model = JsonConvert.DeserializeObject <UserManagementCreateModel>(body);

            if (string.IsNullOrWhiteSpace(model.Username) || string.IsNullOrWhiteSpace(model.Password))
            {
                return(Response.AsJson(new JsonResponseModel
                {
                    Result = false,
                    Message = "Please enter in a valid Username and Password"
                }));
            }

            var users = await UserMapper.GetUsersAsync();

            if (users.Any(x => x.UserName.Equals(model.Username, StringComparison.CurrentCultureIgnoreCase)))
            {
                return(Response.AsJson(new JsonResponseModel
                {
                    Result = false,
                    Message = $"A user with the username '{model.Username}' already exists"
                }));
            }

            var featuresVal    = 0;
            var permissionsVal = 0;

            foreach (var feature in model.Features)
            {
                var f = (int)EnumHelper <Features> .GetValueFromName(feature);

                featuresVal += f;
            }

            foreach (var permission in model.Permissions)
            {
                var f = (int)EnumHelper <Permissions> .GetValueFromName(permission);

                permissionsVal += f;
            }

            var user = UserMapper.CreateUser(model.Username, model.Password, permissionsVal, featuresVal, new UserProperties {
                EmailAddress = model.EmailAddress
            });

            if (user.HasValue)
            {
                return(Response.AsJson(MapLocalUser(UserMapper.GetUser(user.Value), DateTime.MinValue)));
            }

            return(Response.AsJson(new JsonResponseModel {
                Result = false, Message = "Could not save user"
            }));
        }
Exemple #44
0
        public void Can_Get_Borough_List()
        {
            var results = EnumHelper.EnumToList <Borough>().Select(e => e.GetDescription()).ToList();

            Assert.NotNull(results);
        }
Exemple #45
0
 public List<Maticsoft.Model.SNS.AlbumType> GetModelListByCache(EnumHelper.Status Status)
 {
     string cacheKey = "AlbumTypeList_" + ((int) Status);
     object cache = DataCache.GetCache(cacheKey);
     if (cache == null)
     {
         try
         {
             cache = this.GetModelList(" Status=" + ((int) Status));
             if (cache != null)
             {
                 int num = Globals.SafeInt(Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("ModelCache"), 30);
                 DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) num), TimeSpan.Zero);
             }
         }
         catch
         {
         }
     }
     return (List<Maticsoft.Model.SNS.AlbumType>) cache;
 }
Exemple #46
0
 public void SetBaseEndPoint(ServiceURI serviceURI)
 {
     BaseUri = EnumHelper.GetDescription(serviceURI);
 }
Exemple #47
0
        public EnumHelper.OrderMainStatus GetOrderType(EnumHelper.PaymentGateway paymentGateway, EnumHelper.OrderStatus orderStatus, EnumHelper.PaymentStatus paymentStatus, EnumHelper.ShippingStatus shippingStatus)
        {
            EnumHelper.OrderMainStatus preHandle = EnumHelper.OrderMainStatus.PreHandle;
            switch (paymentGateway)
            {
                case EnumHelper.PaymentGateway.cod:
                    if (((orderStatus == EnumHelper.OrderStatus.UnHandle) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.PreHandle;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Cancel) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Cancel;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.UserLock) || (orderStatus == EnumHelper.OrderStatus.AdminLock)) && ((paymentStatus == EnumHelper.PaymentStatus.Unpaid) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped)))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Locking;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Handling;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.Packing))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Shipping;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.Shipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Shiped;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Complete) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.ConfirmShip))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Complete;
                    }
                    return preHandle;

                case EnumHelper.PaymentGateway.bank:
                    if (((orderStatus == EnumHelper.OrderStatus.UnHandle) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Paying;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Cancel) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Cancel;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.UserLock) || (orderStatus == EnumHelper.OrderStatus.AdminLock)) && ((paymentStatus == EnumHelper.PaymentStatus.Unpaid) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped)))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Locking;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.UnHandle) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.PreConfirm;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Handling;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.Packing))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Shipping;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.Shipped))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Shiped;
                    }
                    if (((orderStatus == EnumHelper.OrderStatus.Complete) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.ConfirmShip))
                    {
                        preHandle = EnumHelper.OrderMainStatus.Complete;
                    }
                    return preHandle;
            }
            if (((orderStatus == EnumHelper.OrderStatus.UnHandle) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
            {
                preHandle = EnumHelper.OrderMainStatus.Paying;
            }
            if (((orderStatus == EnumHelper.OrderStatus.Cancel) && (paymentStatus == EnumHelper.PaymentStatus.Unpaid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
            {
                preHandle = EnumHelper.OrderMainStatus.Cancel;
            }
            if (((orderStatus == EnumHelper.OrderStatus.UserLock) || (orderStatus == EnumHelper.OrderStatus.AdminLock)) && ((paymentStatus == EnumHelper.PaymentStatus.Unpaid) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped)))
            {
                preHandle = EnumHelper.OrderMainStatus.Locking;
            }
            if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.UnShipped))
            {
                preHandle = EnumHelper.OrderMainStatus.Handling;
            }
            if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.Packing))
            {
                preHandle = EnumHelper.OrderMainStatus.Shipping;
            }
            if (((orderStatus == EnumHelper.OrderStatus.Handling) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.Shipped))
            {
                preHandle = EnumHelper.OrderMainStatus.Shiped;
            }
            if (((orderStatus == EnumHelper.OrderStatus.Complete) && (paymentStatus == EnumHelper.PaymentStatus.Paid)) && (shippingStatus == EnumHelper.ShippingStatus.ConfirmShip))
            {
                preHandle = EnumHelper.OrderMainStatus.Complete;
            }
            return preHandle;
        }
Exemple #48
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            var boardSettings = this.Get <YafBoardSettings>();

            // create list boxes by populating datasources from Data class
            var themeData = StaticDataHelper.Themes();

            if (themeData.Any())
            {
                this.Theme.DataSource = themeData;
            }

            this.Culture.DataSource =
                StaticDataHelper.Cultures()
                .AsEnumerable()
                .OrderBy(x => x.Field <string>("CultureNativeName"))
                .CopyToDataTable();

            this.Culture.DataTextField  = "CultureNativeName";
            this.Culture.DataValueField = "CultureTag";

            this.ShowTopic.DataSource     = StaticDataHelper.TopicTimes();
            this.ShowTopic.DataTextField  = "TopicText";
            this.ShowTopic.DataValueField = "TopicValue";

            this.FileExtensionAllow.DataSource     = StaticDataHelper.AllowDisallow();
            this.FileExtensionAllow.DataTextField  = "Text";
            this.FileExtensionAllow.DataValueField = "Value";

            this.BindData();

            // bind poll group list
            var pollGroup =
                this.GetRepository <Poll>().PollGroupList(this.PageContext.PageUserID, null, this.PageContext.PageBoardID)
                .Distinct(new AreEqualFunc <TypedPollGroup>((v1, v2) => v1.PollGroupID == v2.PollGroupID))
                .ToList();

            pollGroup.Insert(0, new TypedPollGroup(string.Empty, -1));

            // TODO: vzrus needs some work, will be in polls only until feature is debugged there.
            this.PollGroupListDropDown.Items.AddRange(pollGroup.Select(x => new ListItem(x.Question, x.PollGroupID.ToString())).ToArray());

            // population default notification setting options...
            var items = EnumHelper.EnumToDictionary <UserNotificationSetting>();

            if (!boardSettings.AllowNotificationAllPostsAllTopics)
            {
                // remove it...
                items.Remove(UserNotificationSetting.AllTopics.ToInt());
            }

            var notificationItems =
                items.Select(x => new ListItem(HtmlHelper.StripHtml(this.GetText("CP_SUBSCRIPTIONS", x.Value)), x.Key.ToString())).ToArray();

            this.DefaultNotificationSetting.Items.AddRange(notificationItems);

            // Get first default full culture from a language file tag.
            var langFileCulture = StaticDataHelper.CultureDefaultFromFile(boardSettings.Language)
                                  ?? "en-US";

            if (boardSettings.Theme.Contains(".xml"))
            {
                SetSelectedOnList(ref this.Theme, "yaf");
            }
            else
            {
                SetSelectedOnList(ref this.Theme, boardSettings.Theme);
            }

            // If 2-letter language code is the same we return Culture, else we return  a default full culture from language file

            /* SetSelectedOnList(
            *   ref this.Culture,
            *   langFileCulture.Substring(0, 2) == this.Get<YafBoardSettings>().Culture
            *     ? this.Get<YafBoardSettings>().Culture
            *     : langFileCulture);*/
            SetSelectedOnList(ref this.Culture, boardSettings.Culture);
            if (this.Culture.SelectedIndex == 0)
            {
                // If 2-letter language code is the same we return Culture, else we return  a default full culture from language file
                SetSelectedOnList(
                    ref this.Culture, langFileCulture.Substring(0, 2) == boardSettings.Culture ? boardSettings.Culture : langFileCulture);
            }

            SetSelectedOnList(ref this.ShowTopic, boardSettings.ShowTopicsDefault.ToString());
            SetSelectedOnList(
                ref this.FileExtensionAllow, boardSettings.FileExtensionAreAllowed ? "0" : "1");

            SetSelectedOnList(
                ref this.DefaultNotificationSetting,
                boardSettings.DefaultNotificationSetting.ToInt().ToString());

            this.NotificationOnUserRegisterEmailList.Text =
                boardSettings.NotificationOnUserRegisterEmailList;
            this.AllowThemedLogo.Checked = boardSettings.AllowThemedLogo;
            this.EmailModeratorsOnModeratedPost.Checked = boardSettings.EmailModeratorsOnModeratedPost;
            this.EmailModeratorsOnReportedPost.Checked  = boardSettings.EmailModeratorsOnReportedPost;
            this.AllowDigestEmail.Checked       = boardSettings.AllowDigestEmail;
            this.DefaultSendDigestEmail.Checked = boardSettings.DefaultSendDigestEmail;
            this.ForumEmail.Text       = boardSettings.ForumEmail;
            this.ForumBaseUrlMask.Text = boardSettings.BaseUrlMask;

            this.CopyrightRemovalKey.Text = boardSettings.CopyrightRemovalDomainKey;

            this.DigestSendEveryXHours.Text = boardSettings.DigestSendEveryXHours.ToString();

            if (boardSettings.BoardPollID > 0)
            {
                this.PollGroupListDropDown.SelectedValue = boardSettings.BoardPollID.ToString();
            }
            else
            {
                this.PollGroupListDropDown.SelectedIndex = 0;
            }

            this.PollGroupList.Visible = true;

            // Copyright Linkback Algorithm
            // Please keep if you haven't purchased a removal or commercial license.
            this.CopyrightHolder.Visible = true;
        }
Exemple #49
0
 public List<OrderInfo> GetListByStatus(EnumHelper.OrderMainStatus orderType)
 {
     string strWhere = this.GetWhereByStatus(orderType) + " order by CreatedDate desc ";
     return this.GetModelList(strWhere);
 }
Exemple #50
0
        /// <summary>
        /// Adds the specified site id.
        /// </summary>
        /// <param name="siteId">The site id.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="contentId">The content id.</param>
        /// <param name="commentText">The comment text.</param>
        /// <param name="destiantionUserId">The destiantion user id.</param>
        /// <param name="replyToCommentId">The reply to comment id.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="commentTable">The comment table.</param>
        /// <param name="isOfficialAnswer">if set to <c>true</c> [is official answer].</param>
        /// <param name="sendNotification">if set to <c>true</c> [send notification].</param>
        /// <param name="isInternal">if set to <c>true</c> [is internal].</param>
        /// <returns></returns>
        public static ContentComment Add(Guid siteId, Guid userId, Guid contentId, string commentText, Guid?destiantionUserId, Guid?replyToCommentId, string fileName, CommentTables commentTable, bool isOfficialAnswer, bool sendNotification, bool isInternal = false)
        {
            if (string.IsNullOrEmpty(commentText.Trim()) && string.IsNullOrEmpty(fileName))
            {
                return(null);
            }

            var result = new ContentComment();

            using (var connection = new SqlConnection(Settings.ADONetConnectionString))
            {
                connection.Open();

                var id = Guid.NewGuid();

                var query = string.Format("INSERT INTO {0} ([ID], [SiteId], [ContentID], [UserID], [DestinationUserID], [ReplyToID], [Comment], [FileName], [IsOfficialAnswer], [IsInternal]) " +
                                          "VALUES (@ID, @SiteID, @ContentID, @UserID, @DestinationUserID, @ReplyToID, @Comment, @FileName, @IsOfficialAnswer, @IsInternal) " +
                                          "SELECT c.ID, c.ContentID, c.UserID, c.CreatedAt, contact.UserFullName, dcontact.UserFullName as DestinationUserFullName, c.Comment, c.IsOfficialAnswer, c.IsInternal, c.FileName " +
                                          "FROM {0} as c " +
                                          "LEFT JOIN tbl_User as u ON c.UserID = u.ID " +
                                          "LEFT JOIN tbl_Contact as contact ON u.ContactID = contact.ID " +
                                          "LEFT JOIN tbl_User as du ON c.DestinationUserID = du.ID " +
                                          "LEFT JOIN tbl_Contact as dcontact ON du.ContactID = dcontact.ID " +
                                          "WHERE c.ID = @ID", commentTable.ToString());
                using (var command = new SqlCommand(query, connection))
                {
                    command.Parameters.AddWithValue("@ID", id);
                    command.Parameters.AddWithValue("@SiteID", siteId);
                    command.Parameters.AddWithValue("@ContentID", contentId);
                    command.Parameters.AddWithValue("@UserID", userId);
                    command.Parameters.AddWithValue("@IsInternal", isInternal);

                    if (destiantionUserId.HasValue)
                    {
                        command.Parameters.AddWithValue("@DestinationUserID", destiantionUserId);
                    }
                    else
                    {
                        command.Parameters.AddWithValue("@DestinationUserID", DBNull.Value);
                    }

                    if (replyToCommentId.HasValue)
                    {
                        command.Parameters.AddWithValue("@ReplyToID", replyToCommentId);
                    }
                    else
                    {
                        command.Parameters.AddWithValue("@ReplyToID", DBNull.Value);
                    }

                    command.Parameters.AddWithValue("@Comment", commentText);
                    command.Parameters.AddWithValue("@FileName", fileName);
                    command.Parameters.AddWithValue("@IsOfficialAnswer", isOfficialAnswer);

                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            reader.Read();

                            result.ID                      = (Guid)reader["ID"];
                            result.ContentID               = (Guid)reader["ContentID"];
                            result.UserID                  = (Guid)reader["UserID"];
                            result.FormattedDate           = ((DateTime)reader["CreatedAt"]).ToString("d MMMM в HH:mm");
                            result.UserFullName            = reader["UserFullName"] != DBNull.Value ? (string)reader["UserFullName"] : null;
                            result.DestinationUserFullName = reader["DestinationUserFullName"] != DBNull.Value ? (string)reader["DestinationUserFullName"] : null;
                            result.Comment                 = reader["Comment"] != DBNull.Value
                                            ? ((string)reader["Comment"]).ToHtml()
                                            : null;
                            result.IsOfficialAnswer = reader["IsOfficialAnswer"] != DBNull.Value && (bool)reader["IsOfficialAnswer"];
                            result.IsInternal       = reader["IsInternal"] != DBNull.Value && (bool)reader["IsInternal"];
                            result.FileName         = reader["FileName"] != DBNull.Value ? (string)reader["FileName"] : null;
                            result.SumLike          = 0;
                            result.ContactLike      = false;
                        }
                    }
                }
            }

            var fsp = new FileSystemProvider();

            if (!string.IsNullOrEmpty(result.FileName))
            {
                result.VirtualFileName = fsp.GetLink(siteId, EnumHelper.GetEnumDescription(commentTable), result.FileName, FileType.Attachment);
            }

            if (sendNotification)
            {
                var dataManager = new DataManager();
                switch (commentTable)
                {
                case CommentTables.tbl_RequirementComment:
                    RequirementCommentNotificationService.Notify(dataManager.RequirementComment.SelectById(siteId, result.ID));
                    break;

                case CommentTables.tbl_RequestComment:
                    RequestCommentNotificationService.Notify(dataManager.RequestComment.SelectById(siteId, result.ID));
                    break;

                case CommentTables.tbl_InvoiceComment:
                    InvoiceCommentNotificationService.Notify(dataManager.InvoiceComment.SelectById(siteId, result.ID));
                    break;
                }
            }

            return(result);
        }
Exemple #51
0
        public List<Maticsoft.Model.CMS.Content> GetRecList(int ClassId, EnumHelper.ContentRec Rec, int Top = -1, bool hasImage = false)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append(" State=0 ");
            string str = "";
            switch (Rec)
            {
                case EnumHelper.ContentRec.Recomend:
                    str = " IsRecomend=1";
                    break;

                case EnumHelper.ContentRec.Hot:
                    str = " IsHot=1";
                    break;

                case EnumHelper.ContentRec.Color:
                    str = " IsColor=1";
                    break;

                case EnumHelper.ContentRec.Top:
                    str = " IsTop=1";
                    break;

                default:
                    str = " IsRecomend=1";
                    break;
            }
            builder.AppendFormat(" and {0}", str);
            if (ClassId > 0)
            {
                builder.AppendFormat(" and ClassID={0}", ClassId);
            }
            if (hasImage)
            {
                builder.Append(" and ImageUrl is not null");
            }
            DataSet set = this.GetList(Top, builder.ToString(), " Sequence");
            List<Maticsoft.Model.CMS.Content> list = this.DataTableToList(set.Tables[0]);
            List<Maticsoft.Model.CMS.ContentClass> allClass = Maticsoft.BLL.CMS.ContentClass.GetAllClass();
            using (List<Maticsoft.Model.CMS.Content>.Enumerator enumerator = list.GetEnumerator())
            {
                Func<Maticsoft.Model.CMS.ContentClass, bool> predicate = null;
                Maticsoft.Model.CMS.Content content;
                while (enumerator.MoveNext())
                {
                    content = enumerator.Current;
                    if (predicate == null)
                    {
                        predicate = c => c.ClassID == content.ClassID;
                    }
                    Maticsoft.Model.CMS.ContentClass class2 = allClass.FirstOrDefault<Maticsoft.Model.CMS.ContentClass>(predicate);
                    if (class2 != null)
                    {
                        content.ClassName = class2.ClassName;
                    }
                }
            }
            return list;
        }
Exemple #52
0
        public string GetAsOutput()
        {
            EnumHelper<V4PlusEventHeader> eventFormatHelper = new EnumHelper<V4PlusEventHeader>();
            string output = "Dialogue: ";

            foreach (V4PlusEventHeader key in eventFormatHelper.GetEnumList())
            {
                output += GetPropertyAsString(key) + ",";
            }

            output = output.Substring(0, output.Length - 1);
            return output;
        }
Exemple #53
0
        /// <summary>
        /// Selects the by id.
        /// </summary>
        /// <param name="siteId">The site id.</param>
        /// <param name="commentId">The comment id.</param>
        /// <param name="commentTable">The comment table.</param>
        /// <param name="isPortal">if set to <c>true</c> [is portal].</param>
        /// <returns></returns>
        public static ContentComment SelectById(Guid siteId, Guid commentId, CommentTables commentTable, bool isPortal = false)
        {
            var result = new ContentComment();

            using (var connection = new SqlConnection(Settings.ADONetConnectionString))
            {
                connection.Open();

                var query = string.Format("SELECT c.ID, c.SiteID, c.ContentID, c.UserID, c.CreatedAt, contact.UserFullName, dcontact.UserFullName as DestinationUserFullName, c.Comment, c.IsOfficialAnswer, c.IsInternal, c.FileName " +
                                          "FROM {0} as c " +
                                          "LEFT JOIN tbl_User as u ON c.UserID = u.ID " +
                                          "LEFT JOIN tbl_Contact as contact ON u.ContactID = contact.ID " +
                                          "LEFT JOIN tbl_User as du ON c.DestinationUserID = du.ID " +
                                          "LEFT JOIN tbl_Contact as dcontact ON du.ContactID = dcontact.ID " +
                                          "WHERE c.ID = @ID AND c.SiteID = @SiteID AND (@IsInternal IS NULL OR IsInternal = @IsInternal)", commentTable.ToString());

                using (var command = new SqlCommand(query, connection))
                {
                    command.Parameters.AddWithValue("@ID", commentId);
                    command.Parameters.AddWithValue("@SiteID", siteId);

                    if (isPortal)
                    {
                        command.Parameters.AddWithValue("@IsInternal", false);
                    }
                    else
                    {
                        command.Parameters.AddWithValue("@IsInternal", DBNull.Value);
                    }

                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            reader.Read();

                            result.ID                      = (Guid)reader["ID"];
                            result.SiteID                  = (Guid)reader["SiteID"];
                            result.ContentID               = (Guid)reader["ContentID"];
                            result.UserID                  = (Guid)reader["UserID"];
                            result.CreatedAt               = (DateTime)reader["CreatedAt"];
                            result.FormattedDate           = ((DateTime)reader["CreatedAt"]).ToString("d MMMM в HH:mm");
                            result.UserFullName            = reader["UserFullName"] != DBNull.Value ? (string)reader["UserFullName"] : null;
                            result.DestinationUserFullName = reader["DestinationUserFullName"] != DBNull.Value ? (string)reader["DestinationUserFullName"] : null;
                            result.Comment                 = reader["Comment"] != DBNull.Value
                                            ? (string)reader["Comment"]
                                            : null;
                            result.IsOfficialAnswer = reader["IsOfficialAnswer"] != DBNull.Value && (bool)reader["IsOfficialAnswer"];
                            result.IsInternal       = reader["IsInternal"] != DBNull.Value && (bool)reader["IsInternal"];
                            result.FileName         = reader["FileName"] != DBNull.Value ? (string)reader["FileName"] : null;
                        }
                    }
                }
            }

            var fsp = new FileSystemProvider();

            if (!string.IsNullOrEmpty(result.FileName))
            {
                result.VirtualFileName = fsp.GetLink(siteId, EnumHelper.GetEnumDescription(commentTable), result.FileName, FileType.Attachment);
            }

            return(result);
        }
Exemple #54
0
 public int GetCountByType(int UserId, EnumHelper.UserGroupType Type)
 {
     string whereByType = this.GetWhereByType(UserId, Type);
     return this.GetRecordCount(whereByType);
 }
        public void CanSerializerAndDesializeEnumLists()
        {
            var helper = new EnumHelper {Tests = new List<EnumHelper.Test> {EnumHelper.Test.A}};
            var bson = Serialize<EnumHelper>(helper);
            var deserialize = Deserialize<EnumHelper>(bson);

            Assert.IsNotNull(deserialize);
            Assert.IsNotNull(deserialize.Tests);
            Assert.Contains(EnumHelper.Test.A, deserialize.Tests);
        }
Exemple #56
0
        /// <summary>
        /// Gets the comments.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="contentId">The content id.</param>
        /// <param name="commentTable">The comment table.</param>
        /// <param name="isPortal">if set to <c>true</c> [is portal].</param>
        /// <returns></returns>
        public static IEnumerable <ContentComment> GetComments(UserMap user, Guid contentId, CommentTables commentTable, bool isPortal = false)
        {
            var result = new List <ContentComment>();

            using (var connection = new SqlConnection(Settings.ADONetConnectionString))
            {
                connection.Open();
                var query = string.Format("SELECT c.ID, c.ContentID, c.CreatedAt, c.UserID, contact.UserFullName, dcontact.UserFullName as DestinationUserFullName, c.Comment, c.IsInternal, c.IsOfficialAnswer, c.FileName, " +
                                          " (CASE WHEN (SELECT [Rank] FROM {0}Mark WHERE ContentCommentID = c.ID AND UserID = @UserID) = 1 THEN 'true' ELSE 'false' END) AS ContactLike, ISNULL(s.[Rank], 0) AS SumLike " +
                                          "FROM {0} as c " +
                                          "LEFT JOIN tbl_User as u ON c.UserID = u.ID " +
                                          "LEFT JOIN tbl_Contact as contact ON u.ContactID = contact.ID " +
                                          "LEFT JOIN tbl_User as du ON c.DestinationUserID = du.ID " +
                                          "LEFT JOIN tbl_Contact as dcontact ON du.ContactID = dcontact.ID " +
                                          "LEFT JOIN {0}Mark AS m ON c.ID = m.ContentCommentID " +
                                          "LEFT JOIN (SELECT ContentCommentID, SUM([Rank]) as [Rank] " +
                                          "FROM {0}Mark " +
                                          "GROUP BY ContentCommentID) s ON c.ID = s.ContentCommentID " +
                                          "WHERE ContentID = @ContentID AND c.SiteID = @SiteID AND (@IsInternal IS NULL OR IsInternal = @IsInternal) ", commentTable.ToString());
                using (var command = new SqlCommand(query, connection))
                {
                    command.Parameters.AddWithValue("@ContentID", contentId);
                    command.Parameters.AddWithValue("@SiteID", user.SiteID);
                    command.Parameters.AddWithValue("@UserID", user.ID);

                    if (isPortal)
                    {
                        command.Parameters.AddWithValue("@IsInternal", false);
                    }
                    else
                    {
                        command.Parameters.AddWithValue("@IsInternal", DBNull.Value);
                    }

                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                result.Add(new ContentComment()
                                {
                                    ID                      = (Guid)reader["ID"],
                                    ContentID               = (Guid)reader["ContentID"],
                                    UserID                  = (Guid)reader["UserID"],
                                    CreatedAt               = (DateTime)reader["CreatedAt"],
                                    FormattedDate           = ((DateTime)reader["CreatedAt"]).ToString("d MMMM в HH:mm"),
                                    UserFullName            = reader["UserFullName"] != DBNull.Value ? (string)reader["UserFullName"] : null,
                                    DestinationUserFullName = reader["DestinationUserFullName"] != DBNull.Value ? (string)reader["DestinationUserFullName"] : null,
                                    Comment                 = reader["Comment"] != DBNull.Value ? ((string)reader["Comment"]).ToHtml() : null,
                                    IsOfficialAnswer        = reader["IsOfficialAnswer"] != DBNull.Value && (bool)reader["IsOfficialAnswer"],
                                    IsInternal              = reader["IsInternal"] != DBNull.Value && (bool)reader["IsInternal"],
                                    FileName                = reader["FileName"] != DBNull.Value ? (string)reader["FileName"] : null,
                                    ContactLike             = bool.Parse((string)reader["ContactLike"]),
                                    SumLike                 = (int)reader["SumLike"]
                                });
                            }

                            reader.NextResult();
                        }
                    }
                }
            }

            var fsp = new FileSystemProvider();

            foreach (ContentComment contentComment in result)
            {
                if (!string.IsNullOrEmpty(contentComment.FileName))
                {
                    contentComment.VirtualFileName = fsp.GetLink(user.SiteID, EnumHelper.GetEnumDescription(commentTable), contentComment.FileName, FileType.Attachment);
                }
            }

            return(result);
        }
Exemple #57
0
        public static string GetFormatOutput()
        {
            EnumHelper<V4PlusEventHeader> eventFormatHelper = new EnumHelper<V4PlusEventHeader>();
            string output = "Format: ";

            foreach (string description in eventFormatHelper.GetDescriptionList())
            {
                output += description + ",";
            }

            output = output.Substring(0, output.Length - 1);
            return output;
        }
 public ActionResult List()
 {
     ViewBag.InType    = EnumHelper.GetOptions <EInType>(0, "请选择入库单类型");
     ViewBag.ReportNum = ResourceManager.GetSettingEntity("InOrder_Template").Value;
     return(View());
 }
Exemple #59
0
 public bool UpdateStatusList(string IdsStr, EnumHelper.GroupStatus status)
 {
     return this.dal.UpdateStatusList(IdsStr, status);
 }
 /// <summary>
 /// 获取场景描述
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public string GetTypeDesc(object type)
 {
     return(EnumHelper.GetDesc(typeof(DiamondExchType), type));
 }