Thursday, November 20, 2014

Retrieving Records from MongoDb and Displaying in GridView

We earlier discussed about Inserting the records to mongoDB via C#.
now the Next Step in the CRUD cycle is Read the data from MongoDb and Flash it on the UI screen.
This is how I did :

Drag and Drop the Gridview control and apply the styles which suites your website screen design


Create Connection like Before :
MongoClient monClient = new MongoClient("mongodb://localhost");
MongoServer ms = monClient.GetServer();



ms.Connect();
 
MongoDatabase db = ms.GetDatabase("testdb");
MongoCollection collection = db.GetCollection<Tasks>("Tasks");
Tasks tsk = new Tasks();

Query the collection and Convert to List
 
var ShowTasks = collection.FindAllAs<Tasks>().ToList<Tasks>();

Set the List as Data source
gvShowTasks.DataSource = ShowTasks;

Binds the Grid

gvShowTasks.DataBind();

Run the Solution.(f5) Bammmm!!! you see that
 

Tuesday, November 11, 2014

Inserting to MongoDB from C#

I have always been a technology enthusiast and like to implement New things .
When I was introduced to mongo DB, an opensource database tool , I wondered how do I perform basic operations thru .Net .
Hence I created a simple application  .
Note : Mongo DB is NoSQL database and not Relational Database Like MSSQL or Oracle.

How I did it .

1.       Add MongoDb Dll Reference.
using MongoDB.Bson;
1.       using MongoDB.Driver;
2.       In the Button Click Event Create Mongo Connection
MongoClient monClient = new MongoClient("mongodb://localhost");
3.       Get Database name
       MongoServer ms = monClient.GetServer();
       ms.Connect();
MongoDatabase db = ms.GetDatabase("testdb");

Get Collections(tables)
MongoCollection collection = db.GetCollection<NewProjects>("Projects");

Add a new class similar to the structure u want the schema to be
public class NewProjects
{
       public NewProjects()
       {
              //
              // TODO: Add constructor logic here
              //
       }
    public string ProjectName { get; set; }
    public string ServiceName { get; set; }
    public string DescriptionName { get; set; }

}

Assign Values to each field (Binding the values from Front End )
NewProjects proj=new NewProjects();
              proj.ProjectName=txtProjName.Text;
              proj.ServiceName=txtServiceName.Text;
       proj.DescriptionName=txtdesc.Text;

Finally Hit Insert Command
collection.Insert(proj);

View the Result in the backend database


Observe that Unique ID  is automatically Created .

Values Passed from Front End





PS: I know you may find it little strange to read Json like Documents(records) because Mongodb stores it in json format . so I have  converted these documents from Json like structure to Table format

Here we go




This application was build with Bootstrap JS


Wednesday, October 15, 2014

MongoDB CRUD


Create/Insert

> db.Employee.insert({Name:"Supreet",Empid:199380,Designation:"Associate Consultant"})
WriteResult({ "nInserted" : 1 })
> db.Employee.insert({Name:"Tom",Empid:199381,Designation:"Project Engineer"})
WriteResult({ "nInserted" : 1 })

Select All documents

> db.Employee.find()
{
"_id" : ObjectId("540d4a2a4069474f1248f63f"),
"Empid" : 199380,
"Name" : "Supreet",
"Designation" : "Associate Consultant"
}
{
"_id" : ObjectId("540d4a654069474f1248f64b"),
"Empid" : 199381,
"Name" : "Tom",
"Designation" : "Project Engineer"
}

Update a document

> db.Employee.update({Empid:199381},{$set:{Designation:"Technical Lead"}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })


> db.Employee.find()
{
"_id" : ObjectId("540d4a2a4069474f1248f63f"),
"Empid" : 199380,
"Name" : "Supreet",
"Designation" : "Associate Consultant"
}
{
"_id" : ObjectId("540d4a654069474f1248f64b"),
"Empid" : 199381,
"Name" : "Tom",
"Designation" : "Technical Lead"
}


remove a document


> db.Employee.remove({Empid:199381})
WriteResult({ "nRemoved" : 1 })
> db.Employee.find()
{
"_id" : ObjectId("540d4a2a4069474f1248f63f"),
"Empid" : 199380,
"Name" : "Supreet",
"Designation" : "Associate Consultant"
}
show all collections(tables) in the database

> show collections
Employee

using OR operator

> db.Employee.find({$or:[{Empid:199380},{Name:"Supreet"}]})
{
"_id" : ObjectId("540d4a2a4069474f1248f63f"),
"Empid" : 199380,
"Name" : "Supreet",
"Designation" : "Associate Consultant"
}

Using Greater than operator

> db.Employee.find({ Empid:{$gt:199379}})
{
"_id" : ObjectId("540d4a2a4069474f1248f63f"),
"Empid" : 199380,
"Name" : "Supreet",
"Designation" : "Associate Consultant"
}

db.products.find({"Price":{$gt:20000}})
/* 0 */
{
    "_id" : ObjectId("55923c10f7928010b0bd8a81"),
    "Name" : "Ego",
    "Category" : "Laptops",
    "Price" : 50000
}

/* 1 */
{
    "_id" : ObjectId("55923c3ef7928010b0bd8a82"),
    "Name" : "Sony1",
    "Category" : "Laptops",
    "Price" : 60000
}

HTML 5 and css 3 for absolute beginners

all we need to start with is :

text editor: Notepad++. did i mention its free?
web-browser: Google Chrome
Ambition

Here is my HTML code

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="stylefile.css">
</head>
<body>
<div id="big_wrapper">
<header id="top_banner">
<h1>Welcome to my new WebSite</h1>
</header>
<nav id ="Menu">
<ul>
<li>Home</li>
<li>Tutorials</li>
<li>Contact Us</li>

</ul>
</nav>
<section id ="main_section">
<article>
<header>
<hgroup>
<h1>HTML5 Overview</h1>
<br>
<h2>HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and
XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.</h2>
</hgroup>
<header>
</article>
<footer id ="foot">
<p>Created By Supreet</p>
</footer>

</section>

</div>
</body>
</html>

CSS
styling the boring lame webiste

1) setting margins and padding to 0px to all tags because some elements have default margins and padding. below code will reset to zero

*{
margin : 0px;
padding: 0px;
}
Rest of the css code:

body
{
text-align:center;
}
#big_wrapper
{
Margin:20px auto;
border: 1px solid black;
width:1000px;
text-align:left

}
#top_banner
{
background-color:cyan;
font-family:Tahoma;
padding:20px;
border:1px bold
}

#Menu li
{
display:inline-block;
padding:5px;
font:bold 12px Tahoma;


}
#Menu
{
background-color:grey;

}
h1{
font:bold 20px Tahoma;

}
h2
{
font:bold 14px Tahoma;
}
header,section,footer,aside,hgroup
{
display:block;
}
#foot
{
text-align:center;
padding:20px;
border:1px solid black;
font:bold 12px Tahoma;
}

Wednesday, March 12, 2014

SAP SD CREDIT/DEBIT MEMO

distribution channnel:way thru which a company sells its products
like Online,retail,wholesale etc

division:Grouping of Products

plant: Location where materials are stored/Produced(can be multiple)
1 company code can have multiple plant.

location from where products or services are delivered.
=========================================================================================


Credit Notes/Debit Notes:
whenever we have overbilled a customer, we can create a credit memos in order to adjust invoice/amount.
option available to create credit are :
- With reference
-without reference

again with reference we have 2 option
-rerraise full invoice
-partial invoice.

debit note are used as an option for complaint processing .like reducing the amount payabale to vendor .
when for ex: you return a damaged goods and ask for reimbursement .
or when customers are billed low than they should have been actually billed.

============================================================================================================


SAP SD- CREATING MASTER

master data
customer master data
material Master data
Customer Material- mapping data
Pricing

Customer Master
-General(Name, address, contact)
-Sales Area(sales org+division+dist Channel) like US , jAPAn
    ->orders:currency,dales district, price group
    ->shipping :shipping condition,delivering plant
    ->billing doc: o/p tax classification, terms of payment
    ->partner functions:ship to party bill to party

-company code

Goto Logistics->sales and distribution->Master Data->Business Partner->Customer->Create

Account related data: reconciliation account
Payment transactions:payment menthods, dunning(reminders for payment)
Insurance : amount insured

to create : tcode ->spro





SAP SD BASIC PROCESS

sales order
purchase order
billing
credit memo
=================================================================
a)Sales process(order to cash)
-sales order processing
how to create a sales order
how to create out bond delivery
pick and post goods issue
Invoice a customer for delivery
=================================================================
Sales Dept
we recieve a sales order
we deliver
finally we bill the customer(Invoicing)

Material Management Dept(purchasing dept)

Production planning dept

Finance and Accounting(FICO)
=============================================================================================

sales order.: wipro recieves a sales order of laptops for ex:
we need to check whether sufficient stock is there in the Warehouse.(check in  SAP)
if yes then we can deliver it
if no, then we will have to check which vendor to contact for raw materials to manufacture it
System will send a purchase order to vendor . and vendor will deliver us the products.
and then Production planning dept will plan for manufacturing .
then company will deliver the material
then invoicing happens.
system will create a financial document.
=================================================================================================

before creating sales order customer might ask for a quotation.

2)delivery
-creating transfer order
-post goods issue.

3)Invoice (Billing document)

Presales activity.
-Inquiries.
-Quoatations

Sales order processing
-creating SO with some data
(item, quantity, Rate, date of Delivery)
Quantity*rate=Revenue(amount)
Shipping
Billing

========================================================================================================
Procurement(Material mgmt)
Check the availibility
check when we can buy from other vendors and sell it to customers
======================================================================
Shipping Process
-Picking
-Packing
======================
creating Quotations
tcode- va21

happy with the quotation? then place a sales order.
TCODE-va01
header,item details to be provided
schedule lines
-data related to delivery. when we can deliver this item

document flow
-gives details from where the sales order was created
for ex: it shows the corresponding quotation.

===========================================================
Delivery
-do delivery
-transport/trasfer order(picking)
-post good issue

picking means giving the details to wipro stores about the sales order to be shipped on the specific dates
and stores will keep it ready to deliver.

PGI-> ensuring that goods has left the company for delivery.

1)Shipping
-picking
-packing

Picking. find the sales order first.

create transfer order.

Create PGI.
========================================================================================================================
Billing
-to do the billing we must have done the delivery else you cannot create a billing doc in SAP.(logically true becasue
without delivering the products why will the customer pay haha)

Point to Remember: SAP will not create billing document against sales order no.
it will always create doc with delivery no.


we can use same quaotation no . for different sales order also.
for ex: we have created a quoatation for 10 items and created sales order for only 5.
so remianing 5 can be used to create another  S.O
===========================================================================================================================

can we convert two sales quoatation to 1 sales order?? if yes, then how??