コード例 #1
0
        public virtual ActionResult GetQuickReturnLabelCost(string orderNumber)
        {
            LogI("GetQuickReturnLabelCost, orderNumber=" + orderNumber);

            var messages = MailViewModel.ValidateQuickReturnLabel(Db, orderNumber);

            ShippingMethodViewModel quickRate = null;

            if (!messages.Any())
            {
                quickRate = MailViewModel.GetQuickPrintLabelRate(Db,
                                                                 DbFactory,
                                                                 ServiceFactory,
                                                                 ShippingService,
                                                                 AccessManager.Company,
                                                                 LogService,
                                                                 Time,
                                                                 WeightService,
                                                                 orderNumber);

                if (quickRate == null)
                {
                    messages.Add(MessageString.Warning("System hasn\'t received any rates"));
                }
            }

            LogI("ChipestRate: " + (quickRate != null ? quickRate.Id.ToString() + ", cost=" + quickRate.Rate : ""));

            return(JsonGet(new ValueMessageResult <ShippingMethodViewModel>()
            {
                IsSuccess = quickRate != null,
                Data = quickRate,
                Messages = messages,
            }));
        }
コード例 #2
0
        public ParentItemDTO CreateFromStyle(IUnitOfWork db,
                                             string styleString,
                                             decimal?customPrice,
                                             MarketType market,
                                             string marketplaceId,
                                             out IList <MessageString> messages)
        {
            messages = new List <MessageString>();

            var style = db.Styles.GetAllActiveAsDto().FirstOrDefault(s => s.StyleID == styleString);

            if (style == null)
            {
                messages.Add(MessageString.Error("Style String was not found"));
                return(null);
            }
            var model = CreateFromStyle(db,
                                        style,
                                        market,
                                        marketplaceId,
                                        out messages);

            if (model != null && customPrice.HasValue)
            {
                model.Variations.ForEach(v => v.CurrentPrice = customPrice.Value);
            }

            return(model);
        }
コード例 #3
0
        public static IList <MessageString> AssignToOrder(IUnitOfWork db,
                                                          ILogService log,
                                                          long emailId,
                                                          string orderNumber,
                                                          DateTime when,
                                                          long?by)
        {
            var messages = new List <MessageString>();

            var email    = db.Emails.GetAll().FirstOrDefault(e => e.Id == emailId);
            var fromDate = when.AddDays(-30);
            var allNotAssignedEmailIds = (from e in db.Emails.GetAll()
                                          join eToO in db.EmailToOrders.GetAll() on e.Id equals eToO.EmailId into assigned
                                          from eToO in assigned.DefaultIfEmpty()
                                          where eToO == null &&
                                          e.ReceiveDate > fromDate &&
                                          e.From == email.From
                                          select e.Id).ToList();

            allNotAssignedEmailIds.Add(emailId);
            allNotAssignedEmailIds = allNotAssignedEmailIds.Distinct().ToList();

            orderNumber = OrderHelper.RemoveOrderNumberFormat(orderNumber);
            var order = db.Orders.GetByCustomerOrderNumber(orderNumber);

            if (order != null)
            {
                var bindings = db.EmailToOrders.GetAll().Where(e => e.EmailId == emailId).ToList();
                foreach (var binding in bindings)
                {
                    log.Info("Remove, orderId=" + binding.OrderId + ", emailId=" + binding.EmailId);
                    db.EmailToOrders.Remove(binding);
                }
                var orderIds = new List <string>()
                {
                    order.CustomerOrderId
                }.Distinct();                                                          //order.AmazonIdentifier,

                foreach (var orderId in orderIds)
                {
                    foreach (var toAssignEmailId in allNotAssignedEmailIds)
                    {
                        db.EmailToOrders.Add(new EmailToOrder()
                        {
                            EmailId    = toAssignEmailId,
                            OrderId    = orderId,
                            CreateDate = when,
                            CreatedBy  = by,
                        });
                    }
                }
                db.Commit();
            }
            else
            {
                messages.Add(MessageString.Error("Unable to find a matching order"));
            }

            return(messages);
        }
コード例 #4
0
 protected void CheckMessageString(MessageString errorMsg)
 {
     if (errorMsg.IsNull())
     {
         throw new NullReferenceException("MessageString object is empty");
     }
 }
コード例 #5
0
    public override void Active()
    {
        base.Active();
        RegistAllCompent();
        zooBuildShow = transform.Find("UIBg/Effect");

        if (BuildUpEffect == null)
        {
            BuildUpEffect = ResourceManager.GetInstance().LoadGameObject(Config.globalConfig.getInstace().BuildUpEffect);
        }
        InitCompent();

        if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true)
        {
            GameManager.GetInstance().Pause(true); //游戏暂停
            //新手阶段   延时若干秒结束旋转继续下一阶段
            GameManager.GetInstance().StartCoroutine(Wait(Config.globalConfig.getInstace().BuildUpShowTime));
        }
        else
        {
            //Hide();
        }

        //UIZooPage uIZooPage = PageMgr.GetPage<UIZooPage>();
        //if (uIZooPage != null)
        //{
        //    uIZooPage.Hide();
        //}
        MessageString.Send((int)GameMessageDefine.UIMessage_ActiveButHidePart, "UIMainPage");
    }
コード例 #6
0
        public void SaveData(string name, LogicObject lo)
        {
            MessageString ms = new MessageString(name, JsonUtils.ClassOrStructToJson(lo));

            msData.mesList.Add(ms);
            EditorUtility.SetDirty(msData);
        }
コード例 #7
0
        //public void UnlockUser(IUnitOfWork db,
        //    long userId)
        //{
        //    var user = db.Users.GetById(userId);
        //    if (user != null)
        //    {
        //        user.IsLockedOut = false;
        //        user.PasswordFailuresSinceLastSuccess = 0;

        //        db.Commit();
        //    }
        //}

        public IList <MessageString> Delete(IUnitOfWork db,
                                            DateTime?when,
                                            long?by)
        {
            var results = new List <MessageString>();

            if (Id == by)
            {
                results.Add(MessageString.From("", "You can't delete yourself"));
                return(results);
            }

            if (Id.HasValue)
            {
                var user = db.Users.GetById(Id.Value);
                if (user != null)
                {
                    user.DeleteDate = when;
                    user.Deleted    = true;
                    db.Commit();
                }
            }

            return(results);
        }
コード例 #8
0
        public static IEnumerable <T> GetObjList <T>(this SqlDataReader dataReader, MessageString errorMsg)
            where T : ITableModel, new()
        {
            if (dataReader.IsNull())
            {
                return(null);
            }

            ICollection <T> objList = null;

            using (dataReader)
            {
                try
                {
                    objList = new List <T>(40);
                    while (dataReader.Read())
                    {
                        T obj = new T();
                        obj.Fill(dataReader);
                        objList.Add(obj);
                    }
                }
                catch (Exception ex) { errorMsg.Append(ex.ToString()); }
            }
            return(objList);
        }
コード例 #9
0
 void BtnAddSubscribe_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //订阅由VoiceServer相关的所有消息
         MessageString mask = new MessageString();
         mask.SourceModule = 0x0000;      //模块掩码
         mask.SourceNumber = 0x0000;
         mask.TargetModule = 0xffff;
         mask.TargetNumber = 0x0000;
         mask.LargeType    = 0x0000;
         mask.MiddleType   = 0x0000;
         mask.SmallType    = 0x0000;
         mask.Number       = 0x0000;
         MessageString message = new MessageString();
         message.SourceModule = 0x0000;      //由VoiceServer发布的所有消息
         message.SourceNumber = 0x0000;      //发给VoiceServer的消息
         message.TargetModule = 0x1514;
         message.TargetNumber = 0x0000;
         message.LargeType    = 0x0000;
         message.MiddleType   = 0x0000;
         message.SmallType    = 0x0000;
         message.Number       = 0x0000;
         if (mDecConnector != null)
         {
             mDecConnector.AddSubscribe(mask, message);
         }
     }
     catch (Exception ex)
     {
         AppendMessage(ex.Message);
     }
 }
コード例 #10
0
        public static bool Apply(
            this SqlTransaction transaction, string TRANSACTION_NAME, MessageString errorMsg)
        {
            bool result = false;

            try
            {
                transaction.Commit();
                result = true;
            }
            catch (Exception ex)
            {
                errorMsg.Append(ex.ToString());
                try
                {
                    if (SString.IsNotNone(TRANSACTION_NAME))
                    {
                        transaction.Rollback(TRANSACTION_NAME);
                    }
                    else
                    {
                        transaction.Rollback();
                    }
                }
                catch (Exception)
                {
                    errorMsg.Append(ex.ToString());
                }
            }
            return(result);
        }
コード例 #11
0
 public virtual IEnumerable <TblModel> GetAll <TblModel>(
     SqlConnection connection, CommandBehavior commandBehavior, MessageString errorMsg)
     where TblModel : ITableModel, new()
 {
     CheckMessageString(errorMsg);
     return(OnGetAll <TblModel>(connection, commandBehavior, errorMsg));
 }
コード例 #12
0
 public static SqlDataReader GetAllDataReader <TblModel>(
     SqlConnection connection, CommandBehavior commandBehavior)
     where TblModel : ITableModel, new()
 {
     using (MessageString errorMsg = new MessageString())
         return(GetAllDataReader <TblModel>(connection, commandBehavior, errorMsg));
 }
コード例 #13
0
 public static IEnumerable <TblModel> GetAllObjList <TblModel>(
     SqlConnection connection, CommandBehavior commandBehavior)
     where TblModel : ITableModel, new()
 {
     using (MessageString errorMsg = new MessageString())
         return(GetAllObjList <TblModel>(connection, commandBehavior, errorMsg));
 }
コード例 #14
0
        public void Decrypt()
        {
            char[] keywordChars             = Keyword.ToCharArray();
            char[] encryptedMessage         = MessageString.ToCharArray();
            char[] unencryptedMessage       = new char[MessageString.Length];
            int    alphabetMatrixLineNumber = 0;

            for (int i = 0; i < encryptedMessage.Length; i++)
            {
                // All the letters in the charToIntDictionary are stored in upper case, so it's important that each letter is converted to an uppercase value
                // or else the Dictionary search will fail
                char letter = char.ToUpper(encryptedMessage[i]);

                if (!char.IsLetter(letter))
                {
                    unencryptedMessage[i] = letter;
                    continue;
                }

                // If the loop has iterated through every row in the alphabetMatrix, it will be reset to start on the first row again
                if (alphabetMatrixLineNumber == keywordChars.Length)
                {
                    alphabetMatrixLineNumber = 0;
                }

                // Gets the position of the first letter of the current row of the alphabetMatrix
                // This position can be used to calculate how offset each character is in regards to their original position in the alphabet
                // For example:'W' is the 23rd letter in the alphabet, which means that the current letter in the encrypted message is 4 positions out of place.
                // We can then find the current letter's original position in the alphabet and add 4 to find the original letter (which is 'H').
                int charOffset = 26 - charToIntDictionary[char.ToUpper(keywordChars[alphabetMatrixLineNumber])];

                // If the letter's position hasn't changed, append it
                if (charOffset == 26)
                {
                    unencryptedMessage[i] = letter;
                }
                else
                {
                    // Gets the position of the current character and finds it's position in the 'normal' alphabet.
                    // It's original letter is then calculated by adding the offset to the letter's current position
                    int originalLetterlPositionInAlphabet = charToIntDictionary[letter];
                    int characterPosition = originalLetterlPositionInAlphabet + charOffset;

                    // If the addition goes over 25, then the alphabet has looped back round to the beginning, so subtracting 26 from the total
                    // will give us a value towards the beginning of the alphabet
                    if (originalLetterlPositionInAlphabet + charOffset > 25)
                    {
                        characterPosition -= 26;
                    }

                    unencryptedMessage[i] = intToCharDictionary[characterPosition];
                }

                alphabetMatrixLineNumber++;
            }

            MessageString = new string(unencryptedMessage);
            CreationDate  = DateTime.Now;
        }
コード例 #15
0
    public static MessageString operator +(MessageString ms1, MessageString ms2)
    {
        MessageString ms = new MessageString(ms1.Length + ms2.Length);

        ms.Append(ms1.ToString());
        ms.Append(ms2.ToString());
        return(ms);
    }
コード例 #16
0
        public static int Exec(
            this SqlConnection connection, CommandType commandType, string sqlText, MessageString errorMsg)
        {
            IEnumerable <SqlParameter> parmList    = null;
            SqlTransaction             transaction = null;

            return(Exec(connection, transaction, commandType, sqlText, parmList, errorMsg));
        }
コード例 #17
0
        public static ItemExportViewModel FromParentASIN(IUnitOfWork db,
                                                         string asin,
                                                         int market,
                                                         string marketplaceId,
                                                         out IList <MessageString> messages)
        {
            messages = new List <MessageString>();

            var parentItem = db.ParentItems.GetAllAsDto().FirstOrDefault(s => s.ASIN == asin &&
                                                                         s.Market == market &&
                                                                         s.MarketplaceId == marketplaceId);

            if (parentItem == null)
            {
                messages.Add(MessageString.Error("Parent ASIN was not found"));
                return(null);
            }

            var items = db.Items.GetAllViewAsDto().Where(i => i.ParentASIN == parentItem.ASIN &&
                                                         !i.IsFBA &&
                                                         i.Market == parentItem.Market &&
                                                         i.MarketplaceId == parentItem.MarketplaceId)
                        .ToList();

            foreach (var item in items)
            {
                item.BrandName = item.BrandName ?? parentItem.BrandName;
            }

            var model = new ItemExportViewModel();

            var            mainItem = items.FirstOrDefault();
            StyleEntireDto style    = mainItem != null && mainItem.StyleId.HasValue
                ? db.Styles.GetByStyleIdAsDto(mainItem.StyleId.Value)
                : null;

            var firstStyleString = items.Any() ? items.First().StyleString : "";

            model.ASIN = parentItem.ASIN;
            model.Id   = parentItem.Id;

            model.Market        = (int)market;
            model.MarketplaceId = marketplaceId;

            model.Name = parentItem.AmazonName;

            model.PictureSourceType = PictureSourceTypes.FromStyle; //NOTE: always generate excel with fresh images
            model.ListingImage      = mainItem?.ImageUrl;
            model.StyleImage        = style?.Image;

            model.VariationList = items
                                  .OrderBy(i => i.StyleId)
                                  .ThenBy(i => SizeHelper.GetSizeIndex(i.StyleSize))
                                  .Select(i => new ItemVariationExportViewModel(i)).ToList();

            return(model);
        }
コード例 #18
0
    public void RemoveItem(string name)
    {
        MessageString ms = GetMessageString(name);

        if (ms != null)
        {
            mesList.Remove(ms);
        }
    }
コード例 #19
0
 public static bool IsOpened(this SqlConnection connection, MessageString errorMsg)
 {
     if ((connection.State == ConnectionState.Open).IsNotTrue())
     {
         errorMsg.Append("Database connection object is not opened");
         return(false);
     }
     return(true);
 }
コード例 #20
0
        public virtual ActionResult Generate(MailViewModel model)
        {
            LogI("Index, model=" + model);

            if (ModelState.IsValid)
            {
                model.OrderID = model.OrderID.RemoveWhitespaces();
                if (model.IsAddressSwitched)
                {
                    model.ToAddress.IsVerified = true;
                }
                else
                {
                    model.FromAddress.IsVerified = true;
                }


                var shipmentProviders = ServiceFactory.GetShipmentProviders(LogService,
                                                                            Time,
                                                                            DbFactory,
                                                                            WeightService,
                                                                            AccessManager.ShipmentProviderInfoList,
                                                                            AppSettings.DefaultCustomType,
                                                                            AppSettings.LabelDirectory,
                                                                            AppSettings.ReserveDirectory,
                                                                            AppSettings.TemplateDirectory);

                var labelService    = new LabelService(shipmentProviders, LogService, Time, DbFactory, EmailService, PdfMaker, AddressService);
                var quantityManager = new QuantityManager(LogService, Time);

                var results = model.Generate(LogService,
                                             Time,
                                             labelService,
                                             quantityManager,
                                             Db,
                                             WeightService,
                                             ShippingService,
                                             AppSettings.IsSampleLabels,
                                             Time.GetAppNowTime(),
                                             AccessManager.UserId);

                model.Messages.AddRange(results);
            }
            else
            {
                model.Messages.AddRange(ModelState.GetErrors().Select(m => MessageString.Error(m)));
            }

            LogI("Index, Generate results=");
            model.Messages.ForEach(m => LogI(m.Status + ": " + m.Message));

            return(new JsonResult {
                Data = model, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #21
0
        public void DealDECMessage(MessageString message, string strData)
        {
            try
            {
                string   strRecordReference;
                string   strDeviceID;
                DateTime dtRecordTime;

                //判断有没有启用艺赛旗录屏控制功能
                if (ConfigInfo == null || ConfigInfo.ListSettings == null)
                {
                    return;
                }
                var setting = ConfigInfo.ListSettings.FirstOrDefault(s => s.Key == Service04Consts.GS_KEY_S04_CTLISA);
                if (setting == null ||
                    setting.Value != "1")
                {
                    return;
                }

                if (DECMessageHelper == null)
                {
                    return;
                }
                //string strMessage = message.ToString();
                string strMessage = string.Format("{0:X4}:{1:X4}:{2:X4}:{3:X4}",
                                                  message.LargeType,
                                                  message.MiddleType,
                                                  message.SmallType,
                                                  message.Number);
                switch (strMessage)
                {
                case DECMessageHelper.MSG_VOC_RECORDSTARTED:
                    //OnDebug(LogMode.Info, string.Format("Voice record started"));
                    strRecordReference = DECMessageHelper.GetRecordReferenceValue(strData);
                    strDeviceID        = DECMessageHelper.GetDeviceIDValue(strData);
                    dtRecordTime       = DECMessageHelper.GetRecordTimeValue(strData);
                    StartScreen(strDeviceID, strRecordReference, dtRecordTime);
                    break;

                case DECMessageHelper.MSG_VOC_RECORDSTOPPED:
                    //OnDebug(LogMode.Info, string.Format("Voice record stopped"));
                    strRecordReference = DECMessageHelper.GetRecordReferenceValue(strData);
                    strDeviceID        = DECMessageHelper.GetDeviceIDValue(strData);
                    dtRecordTime       = DECMessageHelper.GetRecordTimeValue(strData);
                    StopScreen(strDeviceID, strRecordReference, dtRecordTime);
                    break;
                }
            }
            catch (Exception ex)
            {
                OnDebug(LogMode.Error, string.Format("DealDECMessage fail.\t{0}", ex.Message));
            }
        }
コード例 #22
0
 public virtual bool Fill(SqlConnection connection, T primaryKey, out string errorMsg)
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(Fill(connection, primaryKey, _errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }
コード例 #23
0
 public static bool IsOpened(this SqlConnection connection, out string errorMsg)
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(IsOpened(connection, _errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }
コード例 #24
0
 public virtual SqlDataReader GetAll(out string errorMsg)
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(GetAll(_errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }
コード例 #25
0
 public virtual bool Fill(SqlDataReader dataReader, out string errorMsg)
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(Fill(dataReader, _errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }
コード例 #26
0
 public virtual bool Update(SqlConnection connection, SqlTransaction transaction, out string errorMsg)
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(Update(connection, transaction, _errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }
コード例 #27
0
 public virtual bool Update(out string errorMsg)
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(Update(_errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }
コード例 #28
0
 public virtual bool SetEnabled(string tableName, out string errorMsg)
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(SetEnabled(tableName, _errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }
コード例 #29
0
 public virtual bool IsUsed(SqlConnection connection, out string errorMsg)
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(IsUsed(connection, _errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }
コード例 #30
0
 public virtual IEnumerable <TblModel> GetAll <TblModel>(out string errorMsg) where TblModel : ITableModel, new()
 {
     using (MessageString _errorMsg = new MessageString())
         try
         {
             return(GetAll <TblModel>(_errorMsg));
         }
         finally
         {
             errorMsg = _errorMsg.ToString();
         }
 }