コード例 #1
0
ファイル: Db.cs プロジェクト: linjiajianyuan/marketsln
 public static void SaveCustomizedWeight(string customizedInfo, int customizedWeight)
 {
     try
     {
         string sql = "insert into CustomizedWeight (ProductInfo, CustomizedWeight) values ('" + customizedInfo + "','" + customizedWeight + "')";
         SqlHelper.ExecuteNonQuery(sql, ConfigurationManager.AppSettings["pebbledon"]);
     }
     catch (Exception ex)
     {
         ExceptionUtility exceptionUtility = new ExceptionUtility();
         exceptionUtility.CatchMethod(ex, customizedInfo + ": SaveCustomizedWeight ", customizedWeight + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
         throw ExceptionUtility.GetCustomizeException(ex);
     }
 }
コード例 #2
0
        public static void AddAmazonOrderTran(string accountName, AmazonOrderType amazonOrder)
        {
            List <string> sqlList = BuildAddAmazonOrderTranSql(amazonOrder);

            try
            {
                SqlHelper.ExecuteNonQuery(sqlList, ConfigurationManager.AppSettings["marketplace"]);
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, accountName + ": AddAmazonOrderTran ", amazonOrder.Header.order_id + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
                throw ExceptionUtility.GetCustomizeException(ex);
            }
        }
コード例 #3
0
        public static void UpdateShipmentInfoDt(string orderNum, string accountName, DateTime uploadDate)
        {
            string sql = "update OrderHeader set Reference2='" + uploadDate + "' where OrderNum='" + orderNum + "' and AccountName='" + accountName + "'";

            try
            {
                SqlHelper.ExecuteNonQuery(sql, ConfigurationManager.AppSettings["pebbledon"]);
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, accountName + ": UpdateShipmentInfoDt ", orderNum + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
                throw ExceptionUtility.GetCustomizeException(ex);
            }
        }
コード例 #4
0
ファイル: Db.cs プロジェクト: linjiajianyuan/marketsln
        public static void SaveNoteToDb(string orderNum, string channel, string note)
        {
            note = note.Replace("'", "''");
            string updateSql = "update OrderHeader set Note='" + note + "' where Channel='" + channel + "' and OrderNum='" + orderNum + "'";

            try
            {
                SqlHelper.ExecuteNonQuery(updateSql, ConfigurationManager.AppSettings["pebbledon"]);
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, orderNum + ": SaveNoteToDb ", orderNum + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
                throw ExceptionUtility.GetCustomizeException(ex);
            }
        }
コード例 #5
0
ファイル: Db.cs プロジェクト: linjiajianyuan/marketsln
        public static void CancelOrder(string orderNum, string accountName, string channel)
        {
            string sqlUpdate = @"update OrderHeader set TrackingNum='CANCELLED ORDER', Reference2 = 'CANCELLED ORDER', ShippedDate ='2000-01-01 00:00:00.000'
                                 where OrderNum ='" + orderNum + "' and Channel='"
                               + channel + "'";

            try
            {
                SqlHelper.ExecuteNonQuery(sqlUpdate, ConfigurationManager.AppSettings["pebbledon"]);
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, orderNum + ": CancelOrder ", orderNum + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
                throw ExceptionUtility.GetCustomizeException(ex);
            }
        }
コード例 #6
0
        public static void BuildUpdateTrackingTableTran(string orderId, string note, string accountName)
        {
            //string sql = "update ShipmentInfo set UploadNote = '" + note + "', IsUpload ='" + status + "', UploadTime='" + (DateTime)SqlDateTime.MinValue + "' where Channel='Amazon' and OrderID ='" + orderId + "'";
            string        sql     = "update OrderHeader set Reference2='" + System.DateTime.Now + "' where OrderNum='" + orderId + "' and AccountName='" + accountName + "'";
            List <string> sqlList = new List <string>();

            try
            {
                sqlList.Add(sql);
                SqlHelper.ExecuteNonQuery(sqlList, ConfigurationManager.AppSettings["pebbledon"]);
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, orderId + ": BuildUpdateTrackingTableTran: ", orderId + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
                throw ExceptionUtility.GetCustomizeException(ex);
            }
        }
コード例 #7
0
        public static DataTable LoadAmazonInventoryReport(string accountName)
        {
            FileStream   fs = new FileStream(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + accountName + "_AmazonInventoryReport.xml", FileMode.Open, FileAccess.Read);
            StreamReader sr = new StreamReader(fs);

            string[]  line;
            string    content;
            DataTable amazonOnboardInventoryDt = new DataTable();
            int       lineCount = 1;

            try
            {
                while ((content = sr.ReadLine()) != null)
                {
                    if (lineCount == 1)
                    {
                        line = content.Split('\t');
                        amazonOnboardInventoryDt.Columns.Add(line[0], typeof(System.String));  //sku
                        amazonOnboardInventoryDt.Columns.Add(line[1], typeof(System.String));  //asin
                        amazonOnboardInventoryDt.Columns.Add(line[2], typeof(System.Decimal)); //price
                        amazonOnboardInventoryDt.Columns.Add(line[3], typeof(System.Int32));   //qty
                        lineCount++;
                    }
                    else
                    {
                        line = content.Split('\t');
                        DataRow amazonOnboardInventoryDr = amazonOnboardInventoryDt.NewRow();
                        amazonOnboardInventoryDr["sku"]      = line[0].ToString();
                        amazonOnboardInventoryDr["asin"]     = line[1].ToString();
                        amazonOnboardInventoryDr["price"]    = ConvertUtility.ToDecimal(line[2]);
                        amazonOnboardInventoryDr["quantity"] = ConvertUtility.ToInt(line[3]);
                        amazonOnboardInventoryDt.Rows.Add(amazonOnboardInventoryDr);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, "LoadAmazonInventoryReport Error ", accountName + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
                throw ExceptionUtility.GetCustomizeException(ex);
            }

            return(amazonOnboardInventoryDt);
        }
コード例 #8
0
ファイル: Mdl.cs プロジェクト: linjiajianyuan/marketsln
        public static void UploadTrackingNum()
        {
            DataTable sellerAccountDt = Db.Db.GetEbayDeveloperInfo();

            foreach (DataRow sellerAccountDr in sellerAccountDt.Rows)
            {
                string accountName = sellerAccountDr["AccountName"].ToString();
                try
                {
                    string        token         = sellerAccountDr["Token"].ToString();
                    List <string> exceptList    = ConfigurationManager.AppSettings["exceptList"].Split(',').ToList();
                    List <string> exceptSKUList = ConfigurationManager.AppSettings["exceptSKUList"].Split(',').ToList();
                    if (exceptList.Contains(accountName))
                    {
                        continue;
                    }
                    else
                    {
                        DataTable shippedInfoDt = Db.Db.GetEbayShippedOrderInfo(accountName);
                        foreach (DataRow dr in shippedInfoDt.Rows)
                        {
                            string trackingNum = dr["TrackingNum"].ToString();
                            string orderNum    = dr["OrderNum"].ToString();
                            string carrier     = "";
                            if (dr["ShippingCarrier"].ToString().Trim().ToUpper() == "FEDEX")
                            {
                                carrier = "Fedex";
                            }
                            else
                            {
                                carrier = ConfigurationManager.AppSettings["defaultCarrier"];
                            }

                            EbayService.UploadTrackingNum.UploadSingleTrackingNum(trackingNum, orderNum, carrier, accountName, token);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ExceptionUtility.GetCustomizeException(ex);
                }
            }
        }
コード例 #9
0
 public static DataRow GetVisionSkuInfo(string sku)
 {
     try
     {
         string sql = @"select * from pebbledon.dbo.SKUMap where iteza0923 = '" + sku + "' or motovehicleparts = '" + sku + "' or framegeneration = '" + sku + "' or kalegend = '" + sku + "' or beautyequation = '" + sku + "' or kadepot = '" + sku + "'";
         try
         {
             return(SqlHelper.GetDataRow(sql, ConfigurationManager.AppSettings["marketplace"]));
         }
         catch (Exception ex)
         {
             throw new Exception(ex.Message);
         }
     }
     catch (Exception ex)
     {
         ExceptionUtility exceptionUtility = new ExceptionUtility();
         exceptionUtility.CatchMethod(ex, "GetVisionSkuInfo: ", sku + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
         throw ExceptionUtility.GetCustomizeException(ex);
     }
 }
コード例 #10
0
        public static void DeleteUncompletedEbayOrder(string orderId)
        {
            string        sqlLine               = "delete from EbayOrderLine where OrderID ='" + orderId + "'";
            string        sqlHeader             = "delete from EbayOrderHeader where OrderID = '" + orderId + "'";
            string        sqlPaymentTransaction = "delete from EbayPaymentTransaction where OrderID = '" + orderId + "'";
            List <string> sqlList               = new List <string>();

            try
            {
                sqlList.Add(sqlLine);
                sqlList.Add(sqlHeader);
                sqlList.Add(sqlPaymentTransaction);
                SqlHelper.ExecuteNonQuery(sqlList, ConfigurationManager.AppSettings["marketplace"]);
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, orderId + ": DeleteUncompletedEbayOrder: ", orderId + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
                throw ExceptionUtility.GetCustomizeException(ex);
            }
        }
コード例 #11
0
ファイル: Db.cs プロジェクト: linjiajianyuan/marketsln
 public static void InsertNewVisionItem(int maxItemId, string vendorSKU, string visionQty, string visionNjQty, string visionTxQty)
 {
     try
     {
         string sql = @"insert into SKUMap (VendorSKU, ItemID, iteza0923, 
                             motovehicleparts, framegeneration, kalegend, 
                             beautyequation,kadepot, Reference1, Reference2, Reference3) 
                     values ('" + vendorSKU + "','" + maxItemId + "','VIE" + maxItemId
                      + "','VME" + maxItemId + "','VFE" + maxItemId + "','VKA" + maxItemId
                      + "','VBA" + maxItemId + "','VKAA" + maxItemId + "','" + visionQty
                      + "','" + visionNjQty + "','" + visionTxQty
                      + "')";
         SqlHelper.ExecuteNonQuery(sql, ConfigurationManager.AppSettings["pebbledon"]);
     }
     catch (Exception ex)
     {
         ExceptionUtility exceptionUtility = new ExceptionUtility();
         exceptionUtility.CatchMethod(ex, "InsertNewVisionItem", ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
         throw ExceptionUtility.GetCustomizeException(ex);
     }
 }
コード例 #12
0
ファイル: Db.cs プロジェクト: linjiajianyuan/marketsln
        public static void SaveShipmentInfo(string orderNum, string accountName, string channel, string trackingNum, string reference, string reference2, decimal cost, string nativeCommand)
        {
            try
            {
                List <string> sqlList   = new List <string>();
                string        sqlInsert = @"insert into  ShipmentInfo 
                    (TrackingNum, AccountName, OrderNum, Channel, Cost, Reference1,Reference2, LabelCommand) 
             values ('" + trackingNum + "','" + accountName + "','" + orderNum + "','" + channel + "','" + cost + "','" + reference + "','" + reference2 + "','" + nativeCommand + "')";

                string sqlUpdate = "update OrderHeader set TrackingNum='" + trackingNum + "', ShippedDate ='" + System.DateTime.Now + "' where OrderNum ='" + orderNum + "' and Channel='" + channel + "'";
                sqlList.Add(sqlInsert);
                sqlList.Add(sqlUpdate);
                SqlHelper.ExecuteNonQuery(sqlList, ConfigurationManager.AppSettings["pebbledon"]);
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, orderNum + ": SaveShipmentInfo ", orderNum + ": " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
                throw ExceptionUtility.GetCustomizeException(ex);
            }
        }
コード例 #13
0
ファイル: Mdl.cs プロジェクト: linjiajianyuan/marketsln
        public static void AddOrderToDb()
        {
            DataTable sellerAccountDt = Db.Db.GetEbayDeveloperInfo();

            foreach (DataRow sellerAccountDr in sellerAccountDt.Rows)
            {
                try
                {
                    string        token       = sellerAccountDr["Token"].ToString();
                    string        accountName = sellerAccountDr["AccountName"].ToString();
                    List <string> exceptList  = ConfigurationManager.AppSettings["exceptList"].Split(',').ToList();
                    if (exceptList.Contains(accountName))
                    {
                        continue;
                    }
                    else
                    {
                        List <EbayOrderType> orderList = GetOrder.GetOrderFromEbay(token, accountName);
                        foreach (EbayOrderType ebayOrderType in orderList)
                        {
                            try
                            {
                                Db.Db.AddEbayOrderToDb(ebayOrderType);
                            }
                            catch (Exception)
                            {
                                continue;// continue if order already exist in DB
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ExceptionUtility.GetCustomizeException(ex);
                }
            }
        }