コード例 #1
0
        //복호화 처리
        //public IPagedList<ItemLists> DecryptResult(IPagedList<ItemLists> result)
        //{
        //    foreach (var item in result)    //List의 경우
        //    {
        //        //리플렉션 쓰지 말자....
        //        item.GetType().GetProperties().ToList().ForEach(p =>
        //        {
        //            if (p.Name == "IteamUpdateAdminID" || p.Name == "IteamCreateAdminID" || p.Name == "HideYN" || p.Name == "DeleteYN" || p.Name == "CreatedAt" || p.Name == "UpdatedAt" || p.Name == "DataFromRegion" || p.Name == "DataFromRegionDT")       // 복호화 안하고 통과 시킬 녀석들
        //            {
        //                // 추가 처리
        //            }
        //            else
        //            {
        //                Debug.WriteLine((p.GetValue(item, null) ?? "").ToString());
        //                p.SetValue(item, Crypto.AES_decrypt(p.GetValue(item, null).ToString(), globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV), null);   // null인 경우 오류, DB기본값 체크 필요
        //                Debug.WriteLine((p.GetValue(item, null) ?? "").ToString());
        //            }
        //        });
        //    }

        //    return result;

        //}

        // 개별 entity 복호화
        public ItemLists DecryptResult(ItemLists item)
        {
            try
            {
                item.ItemListID      = Crypto.AES_decrypt(item.ItemListID, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.ItemName        = Crypto.AES_decrypt(item.ItemName, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.ItemDescription = Crypto.AES_decrypt(item.ItemDescription, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.ItemPrice       = Crypto.AES_decrypt(item.ItemPrice, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.ItemSellPrice   = Crypto.AES_decrypt(item.ItemSellPrice, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.ItemCategory1   = Crypto.AES_decrypt(item.ItemCategory1, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.ItemCategory2   = Crypto.AES_decrypt(item.ItemCategory2, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.ItemCategory3   = Crypto.AES_decrypt(item.ItemCategory3, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol1           = Crypto.AES_decrypt(item.sCol1, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol2           = Crypto.AES_decrypt(item.sCol2, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol3           = Crypto.AES_decrypt(item.sCol3, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol4           = Crypto.AES_decrypt(item.sCol4, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol5           = Crypto.AES_decrypt(item.sCol5, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol6           = Crypto.AES_decrypt(item.sCol6, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol7           = Crypto.AES_decrypt(item.sCol7, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol8           = Crypto.AES_decrypt(item.sCol8, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol9           = Crypto.AES_decrypt(item.sCol9, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);
                item.sCol10          = Crypto.AES_decrypt(item.sCol10, globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV);

                //리플렉션 안쓴다.
                //result.GetType().GetProperties().ToList().ForEach(p =>
                //{
                //    if (p.Name == "IteamUpdateAdminID" || p.Name == "IteamCreateAdminID" || p.Name == "HideYN" || p.Name == "DeleteYN" || p.Name == "CreatedAt" || p.Name == "UpdatedAt" || p.Name == "DataFromRegion" || p.Name == "DataFromRegionDT")       // 복호화 안하고 통과 시킬 녀석들
                //    {
                //        // 추가 처리
                //    }
                //    else
                //    {
                //        p.SetValue(result, Crypto.AES_decrypt((p.GetValue(result, null) ?? "").ToString(), globalVal.CloudBreadCryptKey, globalVal.CloudBreadCryptIV), null);
                //    }
                //});
            }
            catch (Exception)
            {
                throw;
            }

            return(item);
        }
コード例 #2
0
        public IEnumerator GetWorkshopSkins()
        {
            var workshopQuery = Global.SteamServer.Workshop.CreateQuery();

            workshopQuery.Page    = 1;
            workshopQuery.PerPage = 50000;
            workshopQuery.RequireTags.Add("Version3");
            workshopQuery.Run();

            yield return(new WaitWhile(new System.Func <bool>(() => workshopQuery.IsRunning)));

            bool flag = false;

            data = new ImageData();
            foreach (var item in workshopQuery.Items)
            {
                string itemshortname = null;
                flag = false;
                foreach (var tag in item.Tags)
                {
                    string removeskin = tag.ToLower().Replace("skin", "").Replace(" ", "").Replace("-", "");
                    if (ItemLists.ContainsKey(removeskin))
                    {
                        itemshortname = ItemLists[removeskin];
                        flag          = true;
                        break;
                    }
                }
                if (!flag)
                {
                    continue;
                }

                if (!data.ImageURLs.ContainsKey(itemshortname))
                {
                    data.ImageURLs[itemshortname] = new Dictionary <ulong, string>();
                }
                data.ImageURLs[itemshortname].Add(item.Id, item.PreviewImageUrl);
            }
            workshopQuery.Dispose();
            Interface.Oxide.DataFileSystem.GetFile("WorkshopSkins").WriteObject(data);
            Puts("Success download!");
        }
コード例 #3
0
        // GET: ItemLists/Delete/5
        public ActionResult Delete(string id)
        {
            try
            {
                // Delete  세션체크
                if (!CheckSession())
                {
                    return(Redirect("/AdminLogin/Login"));
                }

                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                ItemLists itemLists = db.ItemLists.Find(id);
                if (itemLists == null)
                {
                    return(HttpNotFound());
                }

                // 관리자 접근 로그
                logMessage.memberID = this.Session["AdminID"].ToString();
                logMessage.Level    = "INFO";
                logMessage.Logger   = "ItemListsController-Delete(id)";
                logMessage.Message  = string.Format("id : {0}", id);
                Logging.RunLog(logMessage);

                return(View(itemLists));
            }
            catch (Exception ex)
            {
                //에러로그
                logMessage.memberID  = this.Session["AdminID"].ToString();
                logMessage.Level     = "ERROR";
                logMessage.Logger    = "ItemListsController-Delete(id)";
                logMessage.Message   = string.Format("id : {0}", id);
                logMessage.Exception = ex.ToString();
                Logging.RunLog(logMessage);

                throw;
            }
        }
コード例 #4
0
ファイル: ModifyPO.cs プロジェクト: jromero82/Bismark
        private void btnRemoveItem_Click(object sender, EventArgs e)
        {
            var command = (Button)sender;

            try
            {
                if (orderList != null)
                {
                    if (gdvItems.SelectedRows.Count > 0)
                    {
                        var orderIndex = gdvOrders.CurrentRow.Index;
                        var itemIndex  = gdvItems.CurrentRow.Index;
                        if (command.Text == "SAVE CHANGES")
                        {
                            ItemCUD.Update(employee.EmployeeId, (Item)itemList[itemIndex]);
                        }
                        else if (command.Text == "NO LONGER REQUIRED")
                        {
                            itemList[itemIndex].Description = "No longer needed.";
                            itemList[itemIndex].Price       = 0;
                            itemList[itemIndex].Quantity    = 0;

                            ItemCUD.Update(employee.EmployeeId, (Item)itemList[itemIndex]);
                        }
                        gdvItems.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                var itemIndex = gdvItems.CurrentRow.Index;
                var items     = ItemLists.GetItemsByOrderId(orderList[gdvItems.CurrentRow.Index].OrderId);
                itemList.Clear();
                foreach (var item in items)
                {
                    itemList.Add(item);
                }
                MessageBox.Show(ex.Message, "Bismark", MessageBoxButtons.OK, MessageBoxIcon.Error);
                gdvItems.Refresh();
            }
        }
コード例 #5
0
        // GET: ItemLists/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ItemLists itemLists = db.ItemLists.Find(id);

            if (itemLists == null)
            {
                return(HttpNotFound());
            }

            //복호화 처리
            if (globalVal.CloudBreadCryptSetting == "AES256")
            {
                DecryptResult(itemLists);
            }

            return(View(itemLists));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "ItemListID, ItemName, ItemDescription, ItemPrice, ItemSellPrice, ItemCategory1, ItemCategory2, ItemCategory3, IteamCreateAdminID, IteamUpdateAdminID, HideYN, DeleteYN, sCol1, sCol2, sCol3, sCol4, sCol5, sCol6, sCol7, sCol8, sCol9, sCol10, CreatedAt, UpdatedAt")] ItemLists itemLists)
        {
            if (ModelState.IsValid)
            {
                db.ItemLists.Add(itemLists);

                // 사용자에게 보여준 시각을 UTC로 변환
                itemLists.CreatedAt = itemLists.CreatedAt.UtcDateTime;
                itemLists.UpdatedAt = itemLists.UpdatedAt.UtcDateTime;

                // Insert : 암호화 처리
                if (globalVal.CloudBreadCryptSetting == "AES256")
                {
                    EncryptResult(itemLists);
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(itemLists));
        }
コード例 #7
0
        // POST: odata/ItemLists
        public IHttpActionResult Post(ItemLists itemLists)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ItemLists.Add(itemLists);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ItemListsExists(itemLists.ItemListID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            // Get the sid of the current user.
            string sid = CBAuth.getMemberID(this.User as ClaimsPrincipal);

            /// admin access log
            logMessage.memberID = sid;
            logMessage.Level    = "INFO";
            logMessage.Logger   = "ItemLists-POST";
            logMessage.Message  = JsonConvert.SerializeObject(itemLists);
            Logging.RunLog(logMessage);

            return(Created(itemLists));
        }
コード例 #8
0
        public ActionResult DeleteConfirmed(string id)
        {
            try
            {
                // Delete  세션체크
                if (!CheckSession())
                {
                    return(Redirect("/AdminLogin/Login"));
                }

                ItemLists itemLists = db.ItemLists.Find(id);
                db.ItemLists.Remove(itemLists);
                db.SaveChanges();

                // 관리자 접근 로그
                logMessage.memberID = this.Session["AdminID"].ToString();
                logMessage.Level    = "INFO";
                logMessage.Logger   = "ItemListsController-DeleteConfirm(id)";
                logMessage.Message  = string.Format("id : {0}", id);
                Logging.RunLog(logMessage);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                //에러로그
                logMessage.memberID  = this.Session["AdminID"].ToString();
                logMessage.Level     = "ERROR";
                logMessage.Logger    = "ItemListsController-DeleteConfirm(id)";
                logMessage.Message   = string.Format("id : {0}", id);
                logMessage.Exception = ex.ToString();
                Logging.RunLog(logMessage);

                throw;
            }
        }
コード例 #9
0
        // DELETE: odata/ItemLists(5)
        public IHttpActionResult Delete([FromODataUri] string key)
        {
            ItemLists itemLists = db.ItemLists.Find(key);

            if (itemLists == null)
            {
                return(NotFound());
            }

            db.ItemLists.Remove(itemLists);
            db.SaveChanges();

            // Get the sid of the current user.
            string sid = CBAuth.getMemberID(this.User as ClaimsPrincipal);

            /// admin access log
            logMessage.memberID = sid;
            logMessage.Level    = "INFO";
            logMessage.Logger   = "ItemLists-DELETE";
            logMessage.Message  = key;
            Logging.RunLog(logMessage);

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #10
0
ファイル: ListSection.cs プロジェクト: CecleCW/ProductMan
        private static RowIdentifier locateNearestRowThatsStillValid( PositionedRowIdentifier current, ItemLists.ItemList itemList, List<RowIdentifier> oldList )
        {
            //
            // Check forward first
            for( int i = current.Position; i < oldList.Count; i++ )
            {
                RowIdentifier ri = oldList[i];
                if( IsValidNextRow( current.RowIdentifier, ri, itemList ) )
                {
                    return ri;
                }
            }

            //
            // Check backwards now
            for( int i = current.Position - 1; i >= 0 && i < oldList.Count; i-- )
            {
                RowIdentifier ri = oldList[i];
                if( IsValidNextRow( current.RowIdentifier, ri, itemList ) )
                {
                    return ri;
                }
            }

            return null;
        }
コード例 #11
0
ファイル: ListSection.cs プロジェクト: CecleCW/ProductMan
 private static bool IsValidNextRow( RowIdentifier ri, RowIdentifier riCompare, ItemLists.ItemList itemList )
 {
     //
     // Only settle on same type rows.
     if( (ri.GroupColumns.Length == 0 ^ riCompare.GroupColumns.Length == 0 ) == false )
     {
         //
         // Only include items that exist now.
         if( itemList.IndexOf( riCompare.Items[0] ) != -1 )
         {
             return true;
         }
     }
     return false;
 }
 public static MsBuildItemGroup Create(params MsBuildItem[] items)
 => new MsBuildItemGroup(ItemLists.Create(items), condition: default(MsBuildCondition));
コード例 #13
0
        public void addItem(TabItem item)
        {
            ItemLists.Add(item);

            this.Invalidate();
        }
コード例 #14
0
    void Save()
    {
        ItemLists items = new ItemLists(itemList, sellList);

        SaveLoad.Save <ItemLists>(items, "Inventory");
    }
コード例 #15
0
        public static async Task  CreateInvoiceWithMailSending(CreateTaxInvoice invoice, string fromEmail, string path, ApplicationUser au)
        {
            int counter = 0;

            try
            {
                //var collectionmr = db.GetCollection<MerchantRegistration>("MerchantRegistration");
                // var mr = collectionmr.FindAll().ToList<MerchantRegistration>().FirstOrDefault();
                InvoiceJSON invoicejson = new InvoiceJSON();
                invoicejson.version = "1.0.1118";
                billLists[] billListarray = new billLists[1];
                billLists   billlist      = new billLists();
                billlist.userGstin     = au.GstId;
                billlist.supplyType    = "O";
                billlist.subSupplyType = 1;
                billlist.docType       = "INV";
                billlist.docNo         = "20";
                //Test
                billlist.docDate     = invoice.DateIssue;
                billlist.transType   = 1;
                billlist.fromGstin   = invoice.GSTIDSeller;
                billlist.fromTrdName = invoice.NameoFSeller;
                //T2
                // billlist.fromAddr1 = mr.Address1;
                // billlist.fromAddr2 = mr.Address2;
                // billlist.fromPlace = mr.City;
                billlist.fromStateCode       = 27;
                billlist.actualFromStateCode = 27;
                //T2
                billlist.toGstin           = invoice.GSTIdBuyer;
                billlist.toTrdName         = invoice.NameBuyer;
                billlist.toAddr1           = "1st floor, Jain Complex, opp.Bhoot Nath Mandir, Indra Nagar";
                billlist.toAddr2           = "";
                billlist.toPlace           = "Pune";
                billlist.toStateCode       = 27;
                billlist.actualToStateCode = 27;
                //Test
                billlist.totalValue     = invoice.TotalAmount;// 121.00;
                billlist.cgstValue      = invoice.GSTAmount / 2;
                billlist.sgstValue      = invoice.GSTAmount / 2;
                billlist.igstValue      = 0.00;
                billlist.cessValue      = 0.00;
                billlist.TotNonAdvolVal = 0.00;
                billlist.OthValue       = 0.0000;
                billlist.totInvValue    = invoice.TotalAmount;
                billlist.transMode      = 1;
                billlist.transDistance  = 60;
                counter++;
                billlist.transporterName = "";
                billlist.transporterId   = "";
                billlist.transDocNo      = "";
                billlist.transDocDate    = invoice.DateIssue;
                billlist.vehicleNo       = "";
                billlist.vehicleType     = "R";
                counter++;
                ItemLists[] itemlistarray = new ItemLists[invoice.itemDetails.Count];
                for (int count = 0; count < invoice.itemDetails.Count; count++)
                {
                    ItemLists itemlist = new ItemLists();
                    itemlist.itemNo      = count + 1;
                    itemlist.productName = invoice.itemDetails[count].Product;
                    itemlist.productDesc = invoice.itemDetails[count].Product;
                    itemlist.quantity    = invoice.itemDetails[count].Quantity;
                    //il.qtyUnit = invoice.itemDetails[count].Q;
                    itemlist.qtyUnit       = "Qty";
                    itemlist.taxableAmount = invoice.itemDetails[count].Amount;// (invoice.itemDetails[count].GST / 100) * invoice.itemDetails[count].Amount;
                    itemlist.sgstRate      = Convert.ToInt32(itemlist.taxableAmount / 2);
                    itemlist.cgstRate      = Convert.ToInt32(itemlist.taxableAmount / 2);
                    itemlist.igstRate      = 0;
                    itemlist.cessRate      = 0;
                    itemlist.cessNonAdvol  = 0;
                    itemlistarray[count]   = itemlist;
                }

                billlist.itemList     = itemlistarray;
                billListarray[0]      = billlist;
                invoicejson.billLists = billListarray;
                string json      = JsonConvert.SerializeObject(invoicejson, Formatting.Indented);
                var    menstream = new MemoryStream(Encoding.Default.GetBytes(json));
                // var filePath = Path.GetTempFileName();
                //File.WriteAllBytes(filePath, menstream.ToArray());
                var       stream = new MemoryStream(Encoding.Default.GetBytes(json));
                IFormFile file   = new FormFile(stream, 0, (Encoding.Default.GetBytes(json)).Length, "name", "Invoice.json");

                // var filePath = Path.GetTempFileName();
                var filePath = Path.GetTempFileName();

                using (var streamfile = System.IO.File.Create(filePath))
                {
                    await file.CopyToAsync(streamfile);
                }
                //File.WriteAllBytes(filePath, attachment.Content);

                //using (var streamcreate = System.IO.File.Create(filePath))
                //{

                //}

                //StreamReader streamReader = new StreamReader(new MemoryStream
                //  using (var stream = System.IO.File.Create(filePath))
                {
                    //File.WriteAllBytes(filePath, menstream.ToArray());

                    //await filePath.CopyToAsync(menstream);
                }
                StreamReader streamReader = new StreamReader(filePath);// Server.MapPath("~/FileUpload/" + Path.GetFileName(file.FileName)));
                string       data         = streamReader.ReadToEnd();

                //InvoiceJSON invoiceJSON = JsonConvert.DeserializeObject<InvoiceJSON>(data);
                IpfsClient ipfs   = new IpfsClient("https://ipfs.infura.io:5001");
                var        result = ipfs.FileSystem.AddFileAsync(filePath).Result;
                var        url    = "https://ipfs.io/ipfs/" + result.Id.Hash.ToString() + "?filename=" + "Invoice.json";

                MongoDbRepository <MailInvoice> mdr = new MongoDbRepository <MailInvoice>();

                MailInvoice mi = new MailInvoice();
                mi.invoiceJSON             = invoicejson;
                mi.FromEmail               = fromEmail;
                mi.ToEmail                 = invoice.EmailBuyer;
                mi.InvoiceStatus           = MailInvoiceStatus.Created;
                mi.mailInvoiceCreationType = MailInvoiceCreationType.Created;
                mi.HashUrl                 = url;
                // mi.Hash = Hash;
                mdr.Insert(mi);
                var id = mi.Id.ToString();

                var fromAddress = new MailAddress("*****@*****.**", "From Name");
                var toAddress   = new MailAddress(invoice.EmailBuyer, "To Name");
                counter++;
                const string fromPassword = "******";
                const string subject      = "Invoice";
                ///const string body = "Body";
                Attachment attachment = new Attachment(menstream, new ContentType("application/json"));


                attachment.ContentDisposition.FileName = "Invoice.json";

                // attachment.ContentType= "application/json";

                //mailMessage.Attachments.Add(attachment);
                string authorityAccept = "http://" + path + "/TaxInvoice/Accept?id=" + id;
                string authorityReject = "http://" + path + "/TaxInvoice/Reject?id=" + id;
                //string a1= "<html>You have received an Invoice. Please do check the invoice and conform <a href=\'";


                var html = "<html> You have received an Invoice. Please do check the invoice and conform<br /><a href='" + authorityAccept + "' style= \"background-color: #90EE90\" > Accept </a>&nbsp &nbsp<a href='" + authorityReject + "' style= \"background-color: #FFFF00\" > Reject </a></ html >";


                var smtp = new SmtpClient
                {
                    Host                  = "smtp.gmail.com",
                    Port                  = 587,
                    EnableSsl             = true,
                    DeliveryMethod        = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
                };
                using (var message = new MailMessage(fromAddress, toAddress)
                {
                    Subject = subject,
                    Body = html,
                    IsBodyHtml = true
                })

                {
                    message.Attachments.Add(attachment);
                    smtp.Send(message);
                }
                // return invoicejson;
            }
            catch (Exception e)
            {
                // return invoicejson;
            }
        }