Esempio n. 1
0
    protected void btnUpDatePic_Click(object sender, EventArgs e)
    {
        RetrieveCriteria rcGoodsPics = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));

        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__DEFAULTPHOTO);
        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__NAME);
        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
        Condition c = rcGoodsPics.GetNewCondition();

        c.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
        c.AddNotEqualTo(XiHuan_UserGoodsEntity.__DEFAULTPHOTO, "images/none.jpg");
        rcGoodsPics.OrderBy(XiHuan_UserGoodsEntity.__CREATEDATE, false);
        rcGoodsPics.Top = 6;
        EntityContainer ecGoods = rcGoodsPics.AsEntityContainer();
        string          pics    = "var pics=\"";
        string          links   = "var links=\"";
        string          texts   = "var texts=\"";

        foreach (XiHuan_UserGoodsEntity goods in ecGoods)
        {
            pics  += goods.DefaultPhoto.Replace(GlobalVar.DefaultPhotoSize, GlobalVar.BigPhotoSize) + "|";
            links += goods.DetailUrl + "|";
            texts += ValidatorHelper.SafeSql(goods.Name) + "|";
        }
        pics  = pics.TrimEnd('|') + "\";";
        links = links.TrimEnd('|') + "\";";
        texts = texts.TrimEnd('|') + "\";";
        Query.ProcessSqlNonQuery(string.Format("update xihuan_systemconfig set configvalue='{0}' where configkey='HomeRounPics'", pics + links + texts), GlobalVar.DataBase_Name);
        SystemConfigFacade.Refresh();
        Alert("幻灯片成功更新!");
    }
Esempio n. 2
0
    private void GetDetail()
    {
        RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserInfoEntity));
        Condition        c  = rc.GetNewCondition();

        c.AddEqualTo(XiHuan_UserInfoEntity.__USERNAME, txtUserName.Text.Trim());
        rc.AddSelect(XiHuan_UserInfoEntity.__ID);
        rc.AddSelect(XiHuan_UserInfoEntity.__ORIGNALPWD);
        rc.AddSelect(XiHuan_UserInfoEntity.__ISLOCKED);
        XiHuan_UserInfoEntity user = rc.AsEntity() as XiHuan_UserInfoEntity;

        if (user != null)
        {
            if (user.IsLocked == 0)
            {
                lblResult.Text = string.Format("密码为:<span class=\"highlight\">{0}</span>,<a href=\"###\" onclick=\"LockUser({1});\">锁定此账号</a>", user.OrignalPwd, user.ID);
            }
            if (user.IsLocked == 1)
            {
                lblResult.Text = string.Format("密码为:<span class=\"highlight\">{0}</span>,<a href=\"###\" onclick=\"UnLockUser({1});\">撤消锁定此账号</a>", user.OrignalPwd, user.ID);
            }
        }
        else
        {
            lblResult.Text = "<span class=\"highlight\">没有找到此会员的信息!</span>";
        }
    }
Esempio n. 3
0
        private FNRETRIEVAL_STEntity GetRetrievalStation(string retrieval_station)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNRETRIEVAL_STEntity));

            rc.GetNewCondition().AddEqualTo(FNRETRIEVAL_STEntity.__RETRIEVAL_STATION, retrieval_station);
            return((FNRETRIEVAL_STEntity)rc.AsEntity());
        }
Esempio n. 4
0
        public IList<ScheduleEntity> GetCanExecute()
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(tb_ScheduleRelistQueueEntity));
            Condition c = rc.GetNewCondition();
            c.AddEqualTo(tb_ScheduleRelistQueueEntity.__STATE, false);
            c.AddLessThanOrEqualTo(tb_ScheduleRelistQueueEntity.__SCHEDULE, DateTime.Now);

            EntityContainer ec=rc.AsEntityContainer();

            IList<ScheduleEntity> list = new List<ScheduleEntity>();
            if (ec.Count > 0)
            {
                foreach (EntityObject srq in ec)
                {
                    ScheduleEntity sre = new ScheduleEntity();
                    sre.Id = ((tb_ScheduleRelistQueueEntity)srq).id;
                    sre.Nick = userAction.GetUserNick(((tb_ScheduleRelistQueueEntity)srq).user_id);
                    sre.Num_iid = ((tb_ScheduleRelistQueueEntity)srq).num_iid;
                    if (sre.Nick != "")
                    {
                        list.Add(sre);
                    }
                }
            }
            return list;
        }
Esempio n. 5
0
 private void AddFavorite(string id, string name)
 {
     if (!IsUserAlreadyLogin)
     {
         CommonMethod.ResponseAjaxContent(this.Page, "needlogin");
         return;
     }
     else
     {
         RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserFavorateEntity));
         Condition        c  = rc.GetNewCondition();
         c.AddEqualTo(XiHuan_UserFavorateEntity.__USERID, CurrentUserId);
         c.AddEqualTo(XiHuan_UserFavorateEntity.__GOODSID, id);
         rc.AddSelect(XiHuan_UserFavorateEntity.__ID);
         DataTable dt = rc.AsDataTable();
         if (dt != null && dt.Rows.Count > 0)
         {
             CommonMethod.ResponseAjaxContent(this.Page, "already");
             return;
         }
         else
         {
             XiHuan_UserFavorateEntity newfavorite = new XiHuan_UserFavorateEntity();
             newfavorite.UserId    = CurrentUserId;
             newfavorite.GoodsId   = CommonMethod.ConvertToInt(id, 0);
             newfavorite.GoodsName = GlobalObject.unescape(CommonMethod.FinalString(name));
             newfavorite.FacRemark = "";
             newfavorite.FavDate   = DateTime.Now;
             newfavorite.Save();
             CommonMethod.ResponseAjaxContent(this.Page, "ok");
         }
     }
 }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int id = CommonMethod.ConvertToInt(Request["id"], 0);
            if (id > 0)
            {
                RetrieveCriteria rcgoodimage = new RetrieveCriteria(typeof(XiHuan_GoodsImageEntity));
                Condition        c           = rcgoodimage.GetNewCondition();
                c.AddEqualTo(XiHuan_GoodsImageEntity.__GOODSID, id);
                rcgoodimage.AddSelect(XiHuan_GoodsImageEntity.__IMGSRC);
                rcgoodimage.AddSelect(XiHuan_GoodsImageEntity.__IMGDESC);
                rcgoodimage.OrderBy(XiHuan_GoodsImageEntity.__CREATEDATE, false);
                DataTable     dt      = rcgoodimage.AsDataTable();
                StringBuilder sbImage = new StringBuilder();
                StringBuilder sbDesc  = new StringBuilder();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sbImage.AppendFormat("\"{0}\",", dt.Rows[i][XiHuan_GoodsImageEntity.__IMGSRC]);
                    sbDesc.AppendFormat("\"{0}\",", dt.Rows[i][XiHuan_GoodsImageEntity.__IMGDESC]);
                }

                ExecStartupScript(string.Format("imageArray=new Array({0});", sbImage.ToString().TrimEnd(',')));
                ExecStartupScript(string.Format("imageDesc=new Array({0});", sbDesc.ToString().TrimEnd(',')));
                ExecStartupScript("getnext();$('#loadingimage').hide(); $('#saint').show();");
            }
        }
    }
Esempio n. 7
0
    private void InitPage()
    {
        int uid = CommonMethod.ConvertToInt(Request["Id"], 0);

        if (uid > 0)
        {
            #region 浏览过该换品的人

            #region 浏览历史

            int gid = GoodDetail.ID;
            if (IsUserAlreadyLogin)
            {
                RetrieveCriteria rcview = new RetrieveCriteria(typeof(XiHuan_GoodsViewUserEntity));
                Condition        cview  = rcview.GetNewCondition();
                cview.AddEqualTo(XiHuan_GoodsViewUserEntity.__GOODSID, gid);
                cview.AddEqualTo(XiHuan_GoodsViewUserEntity.__VISITORID, CurrentUserId);
                cview.AddEqualTo(XiHuan_GoodsViewUserEntity._TYPE, 1);
                XiHuan_GoodsViewUserEntity newview = rcview.AsEntity() as XiHuan_GoodsViewUserEntity;
                if (CurrentUserId != gid)
                {
                    if (newview == null)
                    {
                        newview             = new XiHuan_GoodsViewUserEntity();
                        newview.GoodsId     = gid;
                        newview.VisitorId   = CurrentUserId;
                        newview.VisitorName = CurrentUserName;
                        newview.Type        = 1;
                    }
                    newview.VisitorHeadImage = CurrentUser.HeadImage;
                    newview.VisitDate        = DateTime.Now;
                    newview.Save();
                }
            }
            #endregion

            #endregion

            StringBuilder sbSql = new StringBuilder("select top 18 Id,Name,DefaultPhoto,ViewCount,DetailUrl from XiHuan_UserGoods with(nolock) where OwnerId={0} and IsChecked=1 order by CreateDate desc, ViewCount desc ;");
            sbSql.Append("select * from XiHuan_UserGoodsChangeRequire with(nolock) where OwnerId={0} order by RequireDate desc; ");
            sbSql.Append("select * from XiHuan_UserGoodsChangeRequire with(nolock) where SenderId={0} order by RequireDate desc; ");
            sbSql.Append("select * from XiHuan_GuestBook with(nolock) where ToId={0} order by CreateDate desc; ");
            sbSql.Append("select FriendId,FriendName from XiHuan_UserFriends with(nolock) where OwnerId={0} order by AddDate desc; ");
            sbSql.Append("select top 10 VisitorId,VisitorName,VisitorHeadImage,VisitDate from XiHuan_GoodsViewUser with(nolock) where Type=1 and GoodsId=" + gid + " order by VisitDate desc;");
            DataSet ds = Query.ProcessMultiSql(string.Format(sbSql.ToString(), uid), GlobalVar.DataBase_Name);
            dlsHotGoods.DataSource = ds.Tables[0];
            dlsHotGoods.DataBind();
            rptSend.DataSource = ds.Tables[1];
            rptSend.DataBind();
            rptRequire.DataSource = ds.Tables[2];
            rptRequire.DataBind();
            rptUserNotes.DataSource = ds.Tables[3];
            rptUserNotes.DataBind();
            rptGoodFriends.DataSource = ds.Tables[4];
            rptGoodFriends.DataBind();
            rptVisitor.DataSource = ds.Tables[5];
            rptVisitor.DataBind();
        }
    }
Esempio n. 8
0
        private bool IsBucketExist(string bucketNo)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNZAIKOEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNZAIKOEntity.__BUCKET_NO, bucketNo);
            return(rc.AsEntity() != null);
        }
Esempio n. 9
0
        public static FNRANGEEntity GetRange(string termNo)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNRANGEEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNRANGEEntity.__TERMNO, termNo);
            return(rc.AsEntity() as FNRANGEEntity);
        }
Esempio n. 10
0
        public static FNLOCATEntity GetLocationBySystemid(string systemid)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNLOCATEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNLOCATEntity.__SYSTEMID, systemid);
            return(rc.AsEntity() as FNLOCATEntity);
        }
Esempio n. 11
0
        public static FNHANSOEntity GetHansoByBucketNo(string bucketNo)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNHANSOEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNHANSOEntity.__BUCKET_NO, bucketNo);
            return(rc.AsEntity() as FNHANSOEntity);
        }
Esempio n. 12
0
        public static FNHANSOEntity GetTransData(string mcKey)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNHANSOEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNHANSOEntity.__MCKEY, mcKey);
            return(rc.AsEntity() as FNHANSOEntity);
        }
Esempio n. 13
0
        public static USERATTRIBUTEEntity GetUserAttributeByUserId(string userId)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(USERATTRIBUTEEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(USERATTRIBUTEEntity.__USERID, userId);
            return(rc.AsEntity() as USERATTRIBUTEEntity);
        }
Esempio n. 14
0
 public string GetSessionKey(string nick)
 {
     RetrieveCriteria rc = new RetrieveCriteria(typeof(tb_UserEntity));
     Condition c = rc.GetNewCondition();
     c.AddEqualTo(tb_UserEntity.__NICK, nick);
     tb_UserEntity user = (tb_UserEntity)rc.AsEntity();
     return user.SessionKey;
 }
Esempio n. 15
0
        public static TERMINALEntity GetTermByIP(string ipAddress)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(TERMINALEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(TERMINALEntity.__IPADDRESS, ipAddress);
            return(rc.AsEntity() as TERMINALEntity);
        }
Esempio n. 16
0
        public static FNSTATIONEntity GetStation(string stNo)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNSTATIONEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNSTATIONEntity.__STNO, stNo);
            return(rc.AsEntity() as FNSTATIONEntity);
        }
Esempio n. 17
0
        public static FNZAIKOEntity GetZaiKoByTicketNo(string ticketNo)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNZAIKOEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNZAIKOEntity.__TICKET_NO, ticketNo);
            return(rc.AsEntity() as FNZAIKOEntity);
        }
Esempio n. 18
0
    private void LoadDetail()
    {
        #region 浏览过该换品的人

        #region 浏览历史

        int gid = CommonMethod.ConvertToInt(Request["gid"], 0);
        if (gid > 0)
        {
            if (IsUserAlreadyLogin)
            {
                RetrieveCriteria rcview = new RetrieveCriteria(typeof(XiHuan_GoodsViewUserEntity));
                Condition        cview  = rcview.GetNewCondition();
                cview.AddEqualTo(XiHuan_GoodsViewUserEntity.__GOODSID, gid);
                cview.AddEqualTo(XiHuan_GoodsViewUserEntity.__VISITORID, CurrentUserId);
                cview.AddEqualTo(XiHuan_GoodsViewUserEntity._TYPE, 0);
                XiHuan_GoodsViewUserEntity newview = rcview.AsEntity() as XiHuan_GoodsViewUserEntity;
                if (newview == null)
                {
                    newview             = new XiHuan_GoodsViewUserEntity();
                    newview.GoodsId     = gid;
                    newview.VisitorId   = CurrentUserId;
                    newview.VisitorName = CurrentUserName;
                    newview.Type        = 0;
                }
                newview.VisitorHeadImage = CurrentUser.HeadImage;
                newview.VisitDate        = DateTime.Now;
                newview.Save();
            }
            #endregion

            string        sql           = @"select  top 10 VisitorId,VisitorName,VisitorHeadImage,VisitDate from XiHuan_GoodsViewUser with(nolock) where Type=0 and GoodsId={0} order by VisitDate desc;
                              declare  @vcount int;
                              update xihuan_usergoods set viewcount=viewcount+1,@vcount=viewcount+1 where id= {0};
                              select @vcount;";
            DataSet       ds            = Query.ProcessMultiSql(string.Format(sql, gid), GlobalVar.DataBase_Name);
            DataTable     dt            = ds.Tables[0];
            DataTable     dt2           = ds.Tables[1];
            int           viewcount     = (dt2 != null && dt2.Rows.Count > 0 ? CommonMethod.ConvertToInt(dt2.Rows[0][0], 0) : 0);
            StringBuilder sbViewContent = new StringBuilder();
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    sbViewContent.AppendFormat("<li style=\"width: 170px; text-align: left;\"><a title=\"浏览时间{0}\" href=\"{1}\" target=\"_blank\"><img style=\"border: 0px; vertical-align: middle;\" title=\"{2}\" src=\"{3}\" width=\"50\" height=\"40\" />&nbsp;&nbsp;{4}</a></li>",
                                               dr["VisitDate"], SrcRootPath + "xh.aspx?id=" + dr["VisitorId"], dr["VisitorName"], SrcRootPath + dr["VisitorHeadImage"], dr["VisitorName"]);
                }
            }
            else
            {
                CommonMethod.ResponseAjaxContent(this.Page, "尚无登录用户浏览过...$" + viewcount);
                return;
            }

            CommonMethod.ResponseAjaxContent(this.Page, "<ul>" + sbViewContent + "</ul>$" + viewcount);
        }
        #endregion
    }
Esempio n. 19
0
        public static FNZAIKOEntity GetZaiKoInFlatWarehouseByBucketNo(string bucketNo)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNZAIKOEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNZAIKOEntity.__BUCKET_NO, bucketNo);
            c.AddEqualTo(FNZAIKOEntity.__STORAGE_PLACE_FLAG, "1");//平库
            return(rc.AsEntity() as FNZAIKOEntity);
        }
Esempio n. 20
0
        public static FNTOUCYAKUEntity GetArrivalReport(string stationNo)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNTOUCYAKUEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNTOUCYAKUEntity.__STNO, stationNo);
            c.AddEqualTo(FNTOUCYAKUEntity.__SYORIFLG, "1");
            return(rc.AsEntity() as FNTOUCYAKUEntity);
        }
Esempio n. 21
0
        public static bool IsSystemOnline()
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNAREAEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNAREAEntity.__ARCNO, "1");
            c.AddEqualTo(FNAREAEntity.__SYSTEMFLG, "1");
            return(rc.AsEntity() != null);
        }
Esempio n. 22
0
    private void CheckeNotes()
    {
        Transaction t            = new Transaction();
        DataTable   dt           = Query.ProcessSql(@"SELECT Id,Content,ReplyContent FROM XiHuan_GuestBook WITH(nolock) WHERE IsChecked=0 ", GlobalVar.DataBase_Name);
        string      content      = string.Empty;
        string      replycontent = string.Empty;
        int         nid          = 0;

        if (dt != null && dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                nid          = CommonMethod.ConvertToInt(dr["Id"], 0);
                content      = CommonMethod.FinalString(dr["Content"]);
                replycontent = CommonMethod.FinalString(dr["ReplyContent"]);
                if (CommonMethodFacade.ValidFFZF(content).Length == 0 && CommonMethodFacade.ValidFFZF(replycontent).Length == 0)
                {
                    XiHuan_GuestBookEntity notesinfo = new XiHuan_GuestBookEntity();
                    notesinfo.Id = nid;
                    notesinfo.Retrieve();
                    if (notesinfo.IsPersistent)
                    {
                        notesinfo.IsChecked = 1;
                        t.AddSaveObject(notesinfo);
                        XiHuan_MessageEntity notechecknoticemessage = new XiHuan_MessageEntity();
                        notechecknoticemessage.FromId   = 1;
                        notechecknoticemessage.FromName = "喜换网";
                        notechecknoticemessage.ToId     = notesinfo.FromId;
                        notechecknoticemessage.ToName   = notesinfo.FromName;
                        notechecknoticemessage.Content  = string.Format("尊敬的喜换网会员<strong>{0}</strong>,您好:<br/>您给\"{1}\"的留言\"{2}\",已经通过审核,请注意查看!",
                                                                        notesinfo.FromName, notesinfo.ToName, notesinfo.Content);
                        notechecknoticemessage.Flag       = byte.Parse(XiHuan_MessageFacade.MessageState.未读.ToString("d"));
                        notechecknoticemessage.CreateDate = DateTime.Now;
                        t.AddSaveObject(notechecknoticemessage);
                        if (t.Process())
                        {
                            #region   如果是对换品页面的留言,重新生成换品页
                            if (CommonMethod.ConvertToInt(nid, 0) > 0)
                            {
                                RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
                                rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
                                Condition cgoods = rcgoods.GetNewCondition();
                                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, notesinfo.GoodsId);
                                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
                                XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity;
                                if (goods != null)
                                {
                                    CommonMethod.readAspxAndWriteHtmlSoruce("../showdetail.aspx?id=" + notesinfo.GoodsId, "../" + goods.DetailUrl);
                                }
                            }
                            #endregion
                        }
                    }
                }
            }
        }
    }
Esempio n. 23
0
        public static FNRANGEEntity GetRange(string section, string line)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNRANGEEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNRANGEEntity.__MADE_SECTION, section);
            c.AddEqualTo(FNRANGEEntity.__MADE_LINE, line);
            return(rc.AsEntity() as FNRANGEEntity);
        }
Esempio n. 24
0
        public static FMZKEYEntity GetUnmanagedZKey(string zaikey)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FMZKEYEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FMZKEYEntity.__ZAIKEY, zaikey);
            c.AddEqualTo(FMZKEYEntity.__MANAGE_ITEM_FLAG, '1');
            return(rc.AsEntity() as FMZKEYEntity);
        }
Esempio n. 25
0
        public static LOGINUSEREntity GetUser(string userId, string password)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(LOGINUSEREntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(LOGINUSEREntity.__USERID, userId);
            c.AddEqualTo(LOGINUSEREntity.__PASSWORD, password);
            return(rc.AsEntity() as LOGINUSEREntity);
        }
Esempio n. 26
0
        /// <summary>
        /// 返回某个系统选项的值
        /// </summary>
        /// <param name="setupKey">关键字</param>
        /// <returns></returns>
        public string GetAppSetupValue(string setupKey)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(Entity系统选项表));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(Entity系统选项表.__关键字, setupKey);
            Entity系统选项表 ex = (Entity系统选项表)rc.AsEntity();

            return(ex.值);
        }
Esempio n. 27
0
        /// <summary>
        /// 读取所有系统设置选项并保存到静态哈希表
        /// </summary>
        public void GetAppSetup()
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(Entity系统选项表));
            DataTable        dt = rc.AsDataTable();

            foreach (DataRow row in dt.Rows)
            {
                Main.staticAppSetup.Add(row["关键字"].ToString(), row["值"].ToString());
            }
        }
Esempio n. 28
0
        public static LedMessage getLedMessageByLedNo(string ledNo, bool justStart)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(LedMessage));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(LedMessage.__LEDNO, ledNo);
            if (!justStart)
            {
                c.AddEqualTo(LedMessage.__PROCESSED, '0');
            }
            return(rc.AsEntity() as LedMessage);
        }
Esempio n. 29
0
        public void PrintSubdivided(List <FNLABELEntity> labels)
        {
            LabelSubdivided ls = new LabelSubdivided();

            ls.TicketNo  = labels[0].TICKET_NO;
            ls.BucketNo  = labels[0].BUCKET_NO;
            ls.Section   = labels[0].SECTION;
            ls.Line      = labels[0].LINE;
            ls.PrNo      = labels[0].PR_NO;
            ls.ItemCode  = labels[0].ZAIKEY;
            ls.ItemName  = GetItemName(ls.ItemCode);
            ls.ColorCode = labels[0].COLOR_CODE;
            decimal count = 0, weight = 0;

            foreach (FNLABELEntity label in labels)
            {
                count  += label.RETRIEVAL_QTY;
                weight += label.RETRIEVAL_WEIGHT;
            }
            ls.Count        = count.ToString("F0");
            ls.Weight       = weight.ToString();
            ls.Unit         = (labels[0].MASTER_UNIT_WEIGHT * 1000).ToString("F4");
            ls.RetrievalNo  = labels[0].RETRIEVAL_NO.Trim();
            ls.NecessaryQty = labels[0].NECESSARY_QTY.ToString("F0");
            ls.UserName     = labels[0].USERNAME;
            if (labels[0].OPTION_FLAG.Equals("1"))
            {
                ls.OptionFlag = "(直行)";
            }

            ls.StartDate = (labels[0].START_DATE.Length == 8 ? labels[0].START_DATE.Insert(4, "/").Insert(7, "/") : labels[0].START_DATE) + (labels[0].START_TIMING_FLAG == "1" ? "AM" : labels[0].START_TIMING_FLAG == "2" ? "PM" : "");

            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNLABELEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNLABELEntity.__LABEL_TYPE, '5');
            c.AddEqualTo(FNLABELEntity.__RETRIEVAL_NO, labels[0].RETRIEVAL_NO);
            c.AddEqualTo(FNLABELEntity.__SERIAL_NO, labels[0].SERIAL_NO);
            c.AddEqualTo(FNLABELEntity.__PRINTING_FLAG, "3");
            int currentPage = rc.AsEntityContainer().Count + 1;

            rc = new RetrieveCriteria(typeof(FNLABELEntity));
            c  = rc.GetNewCondition();
            c.AddEqualTo(FNLABELEntity.__LABEL_TYPE, '5');
            c.AddEqualTo(FNLABELEntity.__RETRIEVAL_NO, labels[0].RETRIEVAL_NO);
            c.AddEqualTo(FNLABELEntity.__SERIAL_NO, labels[0].SERIAL_NO);
            int totalPage = rc.AsEntityContainer().Count;

            ls.Page = string.Format("{0}/{1}", currentPage, totalPage);

            pc.DoPrint(GetPrintName(labels[0].PRINTER_NO), ls);
        }
Esempio n. 30
0
    private void CheckNotes(string id, string gid)
    {
        #region 留言通过审核,给留言人发送提醒短消息,提醒留言已通过审核

        Transaction            t         = new Transaction();
        XiHuan_GuestBookEntity notesinfo = new XiHuan_GuestBookEntity();
        notesinfo.Id = CommonMethod.ConvertToInt(id, 0);
        notesinfo.Retrieve();
        if (notesinfo.IsPersistent)
        {
            notesinfo.IsChecked = 1;
            t.AddSaveObject(notesinfo);
            XiHuan_MessageEntity notechecknoticemessage = new XiHuan_MessageEntity();
            notechecknoticemessage.FromId   = 1;
            notechecknoticemessage.FromName = "喜换网";
            notechecknoticemessage.ToId     = notesinfo.FromId;
            notechecknoticemessage.ToName   = notesinfo.FromName;
            notechecknoticemessage.Content  = string.Format("尊敬的喜换网会员<strong>{0}</strong>,您好:<br/>您给\"{1}\"的留言\"{2}\",已经通过审核,请注意查看!",
                                                            notesinfo.FromName, notesinfo.ToName, notesinfo.Content);
            notechecknoticemessage.Flag       = byte.Parse(XiHuan_MessageFacade.MessageState.未读.ToString("d"));
            notechecknoticemessage.CreateDate = DateTime.Now;
            t.AddSaveObject(notechecknoticemessage);
        }

        #endregion

        if (t.Process())
        {
            #region   如果是对换品页面的留言,重新生成换品页
            if (CommonMethod.ConvertToInt(gid, 0) > 0)
            {
                RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
                rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
                Condition cgoods = rcgoods.GetNewCondition();
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, gid);
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
                XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity;
                if (goods != null)
                {
                    CommonMethod.readAspxAndWriteHtmlSoruce("../showdetail.aspx?id=" + gid, "../" + goods.DetailUrl);
                }
            }
            #endregion

            Alert("恭喜:留言审核成功!");
            BindNotes(0);
        }
        else
        {
            t.RollBack();
        }
    }
Esempio n. 31
0
        private List <FNLABELEntity> GetNextLabel()
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNLABELEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNLABELEntity.__PRINTING_FLAG, "1");
            OrGroup og = c.GetNewOrGroup();

            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "11");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "12");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "13");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "14");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "15");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "16");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "17");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "18");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "19");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "20");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "21");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "22");
            og.AddEqualTo(FNLABELEntity.__PRINTER_NO, "31");
            rc.OrderBy(FNLABELEntity.__BUCKET_NO);
            rc.OrderBy(FNLABELEntity.__PRINTER_NO);
            rc.OrderBy(FNLABELEntity.__RETRIEVAL_STATION);
            rc.OrderBy(FNLABELEntity.__LINE);
            EntityContainer ec = rc.AsEntityContainer();

            if (ec.Count > 0)
            {
                List <FNLABELEntity> labels = new List <FNLABELEntity>();
                for (int i = 0; i < ec.Count; i++)
                {
                    FNLABELEntity label = ec[i] as FNLABELEntity;
                    if (i > 0)
                    {
                        if (label.BUCKET_NO != labels[i - 1].BUCKET_NO || label.PRINTER_NO != labels[i - 1].PRINTER_NO)
                        {
                            break;  //不同的箱号或打印机
                        }
                    }
                    labels.Add(label);
                }
                return(labels);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 32
0
        public static List <FNSIJIEntity> GetSiJis(string mckey)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(FNSIJIEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(FNSIJIEntity.__MCKEY, mckey);
            EntityContainer     ec    = rc.AsEntityContainer();
            List <FNSIJIEntity> sijis = new List <FNSIJIEntity>();

            for (int i = 0; i < ec.Count; i++)
            {
                sijis.Add(ec[i] as FNSIJIEntity);
            }
            return(sijis);
        }
Esempio n. 33
0
 public int GetUserIdByNick(string nick)
 {
     RetrieveCriteria rc = new RetrieveCriteria(typeof(tb_UserEntity));
     Condition c = rc.GetNewCondition();
     c.AddEqualTo(tb_UserEntity.__NICK,nick);
     tb_UserEntity ue = (tb_UserEntity)rc.AsEntity();
     if (ue != null)
     {
         return ue.id;
     }
     else
     {
         return 0;
     }
 }
Esempio n. 34
0
        public bool CheckIsOverTime(string nick)
        {
            RetrieveCriteria rc = new RetrieveCriteria(typeof(tb_UserEntity));
            Condition c = rc.GetNewCondition();
            c.AddEqualTo(tb_UserEntity.__NICK,nick);

            tb_UserEntity ue=(tb_UserEntity)rc.AsEntity();
            //体验版或者过期
            if (ue.syslevel == ((int)Util.Enum.UserSysLevel.Experience).ToString() || ue.authEndTime < DateTime.Now)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
Esempio n. 35
0
		private void cmdDelete()
		{
			string sWhere = "";

			Console.WriteLine( "Enter SQL Where condition ex.:(Name = 'test')" );
			sWhere = Console.ReadLine();
		
			if ( string.IsNullOrEmpty( sWhere ) ) {
				sWhere = "(Name like '%')";
			}
			
			if( m_trans == null ) {
				DeleteCriteria crit = new DeleteCriteria( (new TestObject()).Type, sWhere );
			
				crit.Perform();
				Console.WriteLine( "{0} : Delete request completed = {1}",DateTime.Now.ToLongTimeString(), crit.Count );
			} else {
				RetrieveCriteria rt = new RetrieveCriteria((new TestObject()).Type, sWhere );
				rt.Perform();
				m_trans.Add( rt, PersistentTransaction.ACTION.Delete );
				Console.WriteLine( "{0} : added to delete transaction = {1}", DateTime.Now.ToLongTimeString(), rt.Count );
			}
		}
Esempio n. 36
0
		private void cmdSearch()
		{
			string sWhere = string.Empty;
			string sOrderBy = string.Empty;
			int sCount = 100;
			int sBottom = 0;
			bool sProxy = true;
			RetrieveCriteria crit;

			Console.WriteLine( "Enter SQL Where condition ex.:(Name = 'test')" );
			sWhere = Console.ReadLine();
			if ( string.IsNullOrEmpty( sWhere ) ) {
				sWhere = "(1 = 1)";
				Console.WriteLine( "Search Condition assumed as:" + sWhere );
			}
			// get Order request from user input
			Console.WriteLine( "Enter Order By clause:" );
			sOrderBy = Console.ReadLine();
			if ( string.IsNullOrEmpty( sOrderBy ) )
				Console.WriteLine( "No order condition" );
			// get search count from user input
			Console.WriteLine( "Search count:" );
			try {
				sCount = Convert.ToInt32( Console.ReadLine() );
			} catch { } finally {
				Console.WriteLine( "Count limit is: " + sCount );
			}
			// get bottom count from user input
			Console.WriteLine( "Bottom count:" );
			try {
				sBottom = Convert.ToInt32( Console.ReadLine() );
			} catch { } finally {
				Console.WriteLine( "Bottom is: {0}", sBottom );
			}
			// do retrive proxy or not objects
			Console.WriteLine( "Retrive proxy objects? (Y/N)" );
			if ( string.Compare( Console.ReadLine(), "Y", true ) != 0 ) {
				sProxy = false;
				Console.WriteLine( "\tProxy switch is: {0}", sProxy );
			}

			crit = 
				new RetrieveCriteria( (new TestObject()).Type,
									  sWhere,
									  sOrderBy );
			crit.CountLimit = sCount;
			crit.BottomLimit = sBottom;
			crit.AsProxies = sProxy;
			
			Console.WriteLine( DateTime.Now.ToLongTimeString() +
								": Search request begin" );
			
			crit.Perform();
			
			Console.WriteLine( DateTime.Now.ToLongTimeString() + 
								": Search request completed" );
			Console.WriteLine( "Was found: " + crit.Count );
			
			if ( crit.Count > 0 ) {
				Console.WriteLine( "Count to list:" );

				try {
					int count = Convert.ToInt32( Console.ReadLine() );
					for ( int i = 0; i < count; i++ ) {
						Console.WriteLine( crit[i].ID + "\t" + crit[i].Name + "\t" + crit[i].Stamp.ToString() );
					}
				} catch {
					Console.WriteLine( crit[0].ID + "\t" + crit[0].Name + "\t" + crit[0].Stamp.ToString() );
				}
			}
		}
Esempio n. 37
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_RecommendResultEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_RecommendResultEntity));
     return rc.AsEntityContainer();
 }
Esempio n. 38
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_RecommendResultEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_RecommendResultEntity));
     return rc.AsDataTable();
 }
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_GoldTimeslotSchemeDetailsEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_GoldTimeslotSchemeDetailsEntity));
     return rc.AsDataTable();
 }
Esempio n. 40
0
		public void Search_1LoadTest() {
			RetrieveCriteria ret_crit = new RetrieveCriteria((new TestObject()).Type, "( Name = '" + m_obj_name + "')");
			ret_crit.AsProxies = true;
			ret_crit.Perform();
		}
Esempio n. 41
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_User_SwitchEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_User_SwitchEntity));
     return rc.AsDataTable();
 }
Esempio n. 42
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_TraderateContextEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_TraderateContextEntity));
     return rc.AsEntityContainer();
 }
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_ScheduleRecommendQueueEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_ScheduleRecommendQueueEntity));
     return rc.AsEntityContainer();
 }
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_ScheduleRecommendQueueEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_ScheduleRecommendQueueEntity));
     return rc.AsDataTable();
 }
Esempio n. 45
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_MessageQueueEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_MessageQueueEntity));
     return rc.AsEntityContainer();
 }
Esempio n. 46
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_MessageQueueEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_MessageQueueEntity));
     return rc.AsDataTable();
 }
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_GoldTimeslotSchemeDetailsEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_GoldTimeslotSchemeDetailsEntity));
     return rc.AsEntityContainer();
 }
Esempio n. 48
0
        private void cmdAddError()
		{
            RetrieveCriteria rc = new RetrieveCriteria( (new TestObject()).Type, " (fail :)");
            if( m_trans == null ) {
                rc.Perform();
            } else {
                TestObject obj = new TestObject();
                obj.FailOn = TestObject.FAIL.Save;
                m_trans.Add( obj, PersistentTransaction.ACTION.Save );
            }
		}
Esempio n. 49
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_LdleTimeslotEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_LdleTimeslotEntity));
     return rc.AsEntityContainer();
 }
Esempio n. 50
0
	public void SaveRetriveSearchTransTest()
	{
		PersistentTransaction trans;
		RetrieveCriteria ret_crit;

		// common variables
		TestObject obj;
		int _id_expected;
		string _name_expected;
		DateTime _stamp_expected;

		string _string_expected;
		int? _int_expected;
		bool? _boolean_expected;
		double? _double_expected;
		DateTime? _datetime_expected;


		obj = new TestObject();
		_name_expected = obj.Name = m_obj_name + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
		_int_expected = obj._int = 1234567890;
		_boolean_expected = obj._bool = true;
		_string_expected = obj._string = 
			@"Test строка (ї,ё) 1@№" + DateTime.Now.ToString();
		obj._datetime = DateTime.Now;
		_double_expected = obj._double = (double) 1 / 33;
		
		obj.Save();
		_id_expected = obj.ID;
		_stamp_expected = obj.Stamp;
		_datetime_expected = obj._datetime;

	    #region check props after save
	    Assert.AreEqual( _name_expected, obj.Name );
	    Assert.AreEqual( _int_expected, obj._int );
	    Assert.AreEqual( _boolean_expected, obj._bool );
	    Assert.AreEqual( _string_expected, obj._string );
	    Assert.IsTrue( DateTime.Equals(_datetime_expected, obj._datetime ));
	    Assert.IsTrue( DateTime.Equals( _stamp_expected, obj.Stamp ) );
	    Assert.AreEqual( _double_expected, obj._double );
	    #endregion

		// check property update in transaction
		_name_expected = obj.Name = m_obj_name + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
		_int_expected = obj._int = int.MaxValue;
		_boolean_expected = obj._bool = !obj._bool;
		_string_expected = obj._string = obj.Name;
		_datetime_expected = obj._datetime = DateTime.Now;
		_double_expected = obj._double = (double) 2 / 33;
		
		trans = new PersistentTransaction(obj, PersistentTransaction.ACTION.Save );
		trans.Process();

		_stamp_expected = obj.Stamp;
		_datetime_expected = obj._datetime;
		
		ret_crit = new RetrieveCriteria( obj.Type, "(ID = " + obj.ID );
		ret_crit.Perform();
		
		if( ret_crit.Count != 1 ) {
			Assert.Fail( "Update object in transaction failed!" );
		} else {
			#region check props
			Assert.AreEqual( _name_expected, ((TestObject)ret_crit[0]).Name );
			Assert.AreEqual( _int_expected, ((TestObject) ret_crit[0])._int );
			Assert.AreEqual( _boolean_expected, ((TestObject) ret_crit[0])._bool );
			Assert.AreEqual( _string_expected, ((TestObject) ret_crit[0])._string );
			Assert.IsTrue( DateTime.Equals( _datetime_expected, 
								((TestObject) ret_crit[0])._datetime ) );
			Assert.IsTrue( DateTime.Equals( _stamp_expected, 
								((TestObject) ret_crit[0]).Stamp ) );
			Assert.AreEqual( _double_expected, 
							((TestObject) ret_crit[0])._double );
			#endregion
		}
		
		// check property update in failed transaction
		_name_expected= obj.Name = m_obj_name + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
		_int_expected = obj._int = int.MaxValue;
		_boolean_expected = obj._bool = !obj._bool;
		_string_expected = obj._string = obj.Name;
		_datetime_expected = obj._datetime = DateTime.Now;
		_double_expected = obj._double = (double) 3 / 33;

		trans = new PersistentTransaction( obj, PersistentTransaction.ACTION.Save );
		TestObject fObj = new TestObject();
		fObj.FailOn = TestObject.FAIL.Save;
		trans.Add( fObj, PersistentTransaction.ACTION.Save );
		// run transaction
		try {
			trans.Process();
			Assert.Fail( "Exception wasn't raised" );
		} catch {/*catch exception that will be*/}
		// retrive object to check that nothing was changed
		ret_crit = new RetrieveCriteria( obj.Type, "(ID = " + obj.ID + ")" );
		ret_crit.Perform();

		if( ret_crit.Count != 1 ) {
			Assert.Fail( "Update object in transaction failed!" );
		} else {
			#region check props
			Assert.IsTrue( DateTime.Equals( _stamp_expected, 
							((TestObject) ret_crit[0]).Stamp ) );
			Assert.AreEqual( _name_expected, ((TestObject) ret_crit[0]).Name );
			Assert.AreEqual( _int_expected, ((TestObject) ret_crit[0])._int );
			Assert.AreEqual( _boolean_expected, ((TestObject) ret_crit[0])._bool );
			Assert.AreEqual( _string_expected, ((TestObject) ret_crit[0])._string );
			Assert.IsTrue( DateTime.Equals( _datetime_expected, 
							((TestObject) ret_crit[0])._datetime ) );
			Assert.AreEqual( _double_expected, ((TestObject) ret_crit[0])._double );
			#endregion
		}

		#region delete + failed
		trans = new PersistentTransaction();
		trans.Add( ret_crit[0], PersistentTransaction.ACTION.Delete );
		fObj = new TestObject();
		fObj.FailOn = TestObject.FAIL.Save;
		trans.Add( fObj, PersistentTransaction.ACTION.Save );
		try {
			trans.Process();
			Assert.Fail( "Exception wasn't raised" );
		} catch {/*catch exception that will be*/}
		ret_crit.Perform();
		// object must exist
		Assert.IsTrue( (ret_crit.CountFound == 1), 
						"rollbacked transaction didn't recover deleted object" );
		#endregion

		#region delete
		trans = new PersistentTransaction();
		trans.Add( ret_crit[0], PersistentTransaction.ACTION.Delete );
		trans.Process();
		ret_crit.Perform();
		// object must not exist
		Assert.IsTrue( (ret_crit.CountFound == 0),
						"transaction didn't delete object" );
		#endregion
	}
Esempio n. 51
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_User_SwitchEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_User_SwitchEntity));
     return rc.AsEntityContainer();
 }
Esempio n. 52
0
	public void SaveRetriveSearchTest()
	{
		// common variables
		TestObject obj;
		RetrieveCriteria ret_crit;
		int _id_expected;
		string _name_expected;
		DateTime _stamp_expected;

		string _string_expected;
		int? _int_expected;
		bool? _boolean_expected;
		double? _double_expected;
		DateTime? _datetime_expected;


		obj = new TestObject();
		_name_expected = obj.Name = m_obj_name + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
		_int_expected = obj._int = 1234567890;
		_boolean_expected = obj._bool = true;
		_string_expected = obj._string = 
			@"Test строка (ї,ё) 1@№" + DateTime.Now.ToString();
		obj._datetime = DateTime.Now;
		_double_expected = obj._double = (double) 1 / 33;
		
		// create parent object
		TestObject parent = new TestObject();
		parent.Name = _name_expected;
		parent._int = _int_expected;
		//end
		obj.Parents.Add( parent );
		obj.Save(); //save object
	

		// save data here because of change that can be during conversion to sql pressision
		_datetime_expected = obj._datetime;
		_id_expected = obj.ID;
		_stamp_expected = obj.Stamp;

		#region check props after save
		Assert.AreEqual( _name_expected, obj.Name );
		Assert.AreEqual( _int_expected, obj._int );
		Assert.AreEqual( _boolean_expected, obj._bool );
		Assert.AreEqual( _string_expected, obj._string);
		Assert.IsTrue( DateTime.Equals( _stamp_expected, obj.Stamp ));
		Assert.AreEqual( _double_expected, obj._double );
		// parent check
		foreach (PersistentObject link_obj in obj.Parents ) {
			Assert.AreEqual(_name_expected, link_obj.Name );
		}
		#endregion
		
		// by string equality
		ret_crit = 
			new RetrieveCriteria( 
				(new TestObject()).Type, 
				"(_string = '" + _string_expected +"')" );
		ret_crit.Perform();
		Assert.IsTrue( ( ret_crit.CountFound == 1 ), "Search by _string failed");
		Assert.AreEqual( _id_expected, ret_crit[0].ID );
		// check properties
		Assert.AreEqual( _name_expected, ((TestObject)ret_crit[0]).Name );
		Assert.AreEqual( _int_expected, ((TestObject)ret_crit[0])._int );
		Assert.AreEqual( _boolean_expected, ((TestObject)ret_crit[0])._bool );
		Assert.AreEqual( _string_expected, ((TestObject)ret_crit[0])._string );
		Assert.AreEqual( _stamp_expected, ((TestObject)ret_crit[0]).Stamp );
		Assert.AreEqual( _datetime_expected, ((TestObject)ret_crit[0])._datetime );
		Assert.AreEqual( _double_expected, ((TestObject)ret_crit[0])._double );

		// by LIKE
		ret_crit = 
			new RetrieveCriteria( 
				(new TestObject()).Type, 
				"( _string LIKE '%" + 
				_string_expected.Substring( 2, _string_expected.Length - 2 ) + 
				"%')" );
		ret_crit.Perform();
		Assert.IsTrue( ( ret_crit.CountFound == 1 ), "Search by 'Like' failed");
		Assert.AreEqual( _id_expected, ret_crit[0].ID );
		
		// by string NOT LIKE
		ret_crit = new RetrieveCriteria( 
			(new TestObject()).Type, 
			"( _string NOT LIKE '%" + 
			_string_expected.Substring( 2, _string_expected.Length - 2 ) + 
			"%')" );
		ret_crit.Perform();
		bool found = false;
		int i = 0;
		
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsFalse( found, "Search by 'NOT LIKE' failed" );

		// by ID
		ret_crit = new RetrieveCriteria( 
			(new TestObject()).Type, 
			"( ID = " + _id_expected + ")" );
		ret_crit.Perform();
		Assert.IsTrue( ( ret_crit.CountFound == 1 ), "Search by id failed");
		Assert.AreEqual( _id_expected, ret_crit[0].ID );

		// by NOT ID
		ret_crit = new RetrieveCriteria( 
			(new TestObject()).Type, 
			"( ID <> " + _id_expected + ")" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) { 
				found = true;
				break;
			}
			i++;
		}
		Assert.IsFalse( found, "search by '<> ID' condition failed" );

		// by bit
		ret_crit = new RetrieveCriteria( 
			(new TestObject()).Type,
			"( _bool = CAST(" + ((bool)_boolean_expected ? 1 : 0) + " as bit))" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsTrue( found, "search by _bool failed" );

		// by <> bit
		ret_crit = new RetrieveCriteria( 
			(new TestObject()).Type, 
			"( _bool <> CAST(" + ((bool)_boolean_expected ? 1 : 0) + " as bit))" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsFalse( found, "search by '<> _bool' failed" );

		#region
		// by int
		ret_crit = new RetrieveCriteria( 
			(new TestObject()).Type, 
			"( _int = " + _int_expected + ")" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsTrue( found, "search by _int failed" );

		// by <> int
		ret_crit = new RetrieveCriteria(
			(new TestObject()).Type, 
			"( _int <> " + _int_expected + ")" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsFalse( found, "search by '<> _int' condition failed" );
		#endregion

		// by datetime
		ret_crit = new RetrieveCriteria( 
			(new TestObject()).Type,
			"( _datetime = CAST('" + 
			_datetime_expected.Value.ToString( "yyyy-MM-dd HH:mm:ss.fff" ) + 
			"' as datetime))" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsTrue( found, "Search by _datetime failed" );

		// by <> datetime
		ret_crit = new RetrieveCriteria(
			(new TestObject()).Type,
			"( _datetime <> CAST('" + 
			_datetime_expected.Value.ToString( "yyyy-MM-dd HH:mm:ss.fff" ) + 
			"' as datetime))" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsFalse( found, "Search by '<> _datetime' failed" );

		// by double
		ret_crit = new RetrieveCriteria(
			(new TestObject()).Type,
			"( _double = CAST(" + _double_expected.Value.ToString( "R" )
			.Replace( ",", "." ) +
			" as float ))" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsTrue( found, "Search by _double failed" );

		// by NOT double
		ret_crit = new RetrieveCriteria(
			(new TestObject()).Type,
			"( _double <> CAST(" + _double_expected.Value.ToString( "R" )
				.Replace(",",".") + 
			" as float ))" );
		ret_crit.Perform();
		found = false;
		i = 0;
		while ( i < ret_crit.CountFound && !found ) {
			if ( ret_crit[i].ID == _id_expected ) {
				found = true;
				break;
			}
			i++;
		}
		Assert.IsFalse( found, "Search by '<> _double' failed" );
	}
Esempio n. 53
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_LdleTimeslotEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_LdleTimeslotEntity));
     return rc.AsDataTable();
 }
Esempio n. 54
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_RelistReslutEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_RelistReslutEntity));
     return rc.AsDataTable();
 }
Esempio n. 55
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_TraderateContextEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_TraderateContextEntity));
     return rc.AsDataTable();
 }
Esempio n. 56
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static DataTable Gettb_InGoldTimeItemsEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_InGoldTimeItemsEntity));
     return rc.AsDataTable();
 }
Esempio n. 57
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_InGoldTimeItemsEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_InGoldTimeItemsEntity));
     return rc.AsEntityContainer();
 }
Esempio n. 58
0
 /// <summary>获取所有实体(EntityContainer)</summary>
 public static EntityContainer Retrievetb_RelistReslutEntity()
 {
     RetrieveCriteria rc=new RetrieveCriteria(typeof(tb_RelistReslutEntity));
     return rc.AsEntityContainer();
 }