Tuesday, November 17, 2009

PaymentReceivedDetails !!

public partial class paymentreceiveddetail : System.Web.UI.Page
{
string Printbody;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Request.QueryString.HasKeys())
{
BtnSubmit.Visible = false;
FillPaymentRecDetail();
}
else
{
BtnExToPDF.Visible = false;
BtnEmail.Visible = false;
BtnCopy.Visible = false;
BtnPrint.Visible = false;
PaymentDetail();
}
}
}

//Code for Fill payment Received detail //
private void FillPaymentRecDetail()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
conn.Open();
string id = Request.QueryString["id"].ToString();
string str = "select * from viewPaymentReceived where pr_id=@Payid ";
SqlCommand com = new SqlCommand(str, conn);

SqlParameter PayID = new SqlParameter("@Payid", SqlDbType.Int, 4);
PayID.Value = Request.QueryString["id"];
com.Parameters.Add(PayID);

SqlDataReader dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
lblSupplierName.Text = dr["cust_name"].ToString();

lblInvoiceNo.Text = dr["invoice_no"].ToString();
//foreach (ListItem list in lblInvoiceNo.Text)
//{
// lblInvoiceNo.Text = list.Text + "," + lblInvoiceNo.Text;
//}

lblDate.Text = dr["progDate"].ToString();
lblMode.Text = dr["pmode_name"].ToString();
lblcurrency1.Text = dr["pr_currency"].ToString();
lblAmount.Text = dr["pr_amount"].ToString();
lblBankName.Text = dr["bank_name"].ToString();
lblMICRCode.Text = dr["pr_bank_micr"].ToString();
lblBankBranch.Text = dr["pr_bank_branch"].ToString();
lblInstrumentNo.Text = dr["pr_instrument_no"].ToString();
lblInstrumentDate.Text = dr["progDateInstrument"].ToString();
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}
}
}

//*Code for *//
private void PaymentDetail()
{
using (SqlConnection PaymentConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
PaymentConn.Open();
if (Page.PreviousPage != null)
{

// TextBox _tbxMktFundRs = ((TextBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("tbxMktFundRs"));



DropDownList DDLSupplierName = (DropDownList)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("DDLSupplierName");
lblSupplierName.Text = DDLSupplierName.SelectedItem.Text;
Session["SupplierId"] = DDLSupplierName.SelectedValue.ToString();
// ListBox _ltboxInvoiceNo = (ListBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("ltboxInvoiceNo");
// lblInvoiceNo.Text = _ltboxInvoiceNo.SelectedItem.Text;

CheckBoxList chkboxlistInvoice = (CheckBoxList)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("chkboxlistInvoice");

foreach (ListItem list in chkboxlistInvoice.Items)
{
if (list.Selected)
{
lblInvoiceNo.Text = list.Text + "," + lblInvoiceNo.Text;
}
}

if (lblInvoiceNo.Text != "")
{
lblInvoiceNo.Text = lblInvoiceNo.Text.Substring(0, lblInvoiceNo.Text.Length - 1);
}


//lblInvoiceNo.Text = chkboxlistInvoice.SelectedItem.Text;


TextBox Date = (TextBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("txtDate");
lblDate.Text = Date.Text;
DropDownList Mode = (DropDownList)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("DDLMode");
lblMode.Text = Mode.SelectedItem.Text;
Session["ModeId"] = Mode.SelectedValue.ToString();
TextBox Amount = (TextBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("txtAmount");
lblAmount.Text = Amount.Text;
Session["Amount"] = Amount.Text;
Label Currency = (Label)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("lblcurrency");
lblcurrency1.Text = Currency.Text;

DropDownList BankName = (DropDownList)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("DDLBankName");
lblBankName.Text = BankName.SelectedItem.Text;
Session["BankId"] = BankName.SelectedValue.ToString();
TextBox MICRCode = (TextBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("txtMICRCode");
lblMICRCode.Text = MICRCode.Text;
TextBox BankBranch = (TextBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("txtBankBranch");
lblBankBranch.Text = BankBranch.Text;
TextBox InstrumentNo = (TextBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("txtInstrumentNo");
lblInstrumentNo.Text = InstrumentNo.Text;
TextBox InstrumentDate = (TextBox)PreviousPage.Master.FindControl("ContentPlaceHolder1").FindControl("txtInstrumentDate");
lblInstrumentDate.Text = InstrumentDate.Text;
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
PaymentConn.Close();
}

}
}
protected void BtnCopy_click(object sender, EventArgs e)
{
string id=Request.QueryString["id"].ToString();
Response.Redirect("addpaymentreceived.aspx?action=Copy&ID=" + id + "");
}

private string MakePageBody(string action)
{
if (action == "Print")
{
Printbody = " " + " " +



"" + " " +
"" + " " +
"" + " " +
"";

}
else if (action == "Email")
{
Printbody = "
Payment sent details " + " " +

"
" + " " +



"" + " " +
"" + " " +
"" + " " +
"";

}
Printbody = Printbody + " " + " " +
" " + " " +
"" + " " +
"
Payment sent details " + " " +

"
" + " " +
" " + " " +
" " + " " +
" " + " " +

" " + " " +
" " + " " +
" " + " " +
" " + " " +

" " + " " +
"" + " " +
" " + " " +
"" + " " +

"" + " " +
"" + " " +
" " + " " +
"" + " " +

"" + " " +
" " + " " +
" " + " " +
" " + " " +

" " + " " +
"" + " " +
" " + " " +
"" + " " +

"" + " " +
"" + " " +
" " + " " +
"" + " " +

"" + " " +
"" + " " +
" " + " " +
"" + " " +

" " + " " +
" " + " " +
" " + " " +
" " + " " +

" " + " " +
"" + " " +
" " + " " +
"" + " " +

" " + " " +
"" + " " +
" " + " " +
" " + " " +
" " + " " +
" " + " " +
"
Supplier Name: " + lblSupplierName.Text + "
Invoice No. :" + lblInvoiceNo.Text + "
Date:" + lblDate.Text + "
Mode:" + lblMode.Text + "
Amount:" + lblAmount.Text + "
Bank Name:" + lblBankName.Text + "
MICR Code: " + lblMICRCode.Text + "
Bank Branch:" + lblBankBranch.Text + "
Instrument No.:" + lblInstrumentNo.Text + "
Instrument Date:" + lblInstrumentDate.Text + "
 " + " " +

" " + " " +

"
";
return Printbody;
}
protected void BtnPrint_click(object sender, EventArgs e)
{
Session["PrintBody"] = MakePageBody("Print");
//Response.Redirect("Print.aspx");
Response.Write("");
}
protected void BtnEmail_click(object sender, EventArgs e)
{
Session["EmailBody"] = MakePageBody("Email");
Response.Redirect("SendEmail.aspx?Page=PaymnetReceived&ID=" + Request.QueryString["id"] + "");
}
protected void BtnBack_click(object sender, EventArgs e)
{
if (Request.QueryString.HasKeys())
{
Response.Redirect("viewpaymentreceived.aspx");
}
else
{
//Response.Redirect( "Back to previous page" );

Response.Redirect("addpaymentreceived.aspx");
}
}
protected void BtnExToPDF_click(object sender, EventArgs e)
{

}
protected void BtnSubmit_click(object sender, EventArgs e)
{
insertPaymentSent();
UpdateCustomerMaster();
UpdateRecInvoiceMaster();
Response.Redirect("viewpaymentreceived.aspx");
}

//Code for Update tblSupplierMaster //
private void UpdateCustomerMaster()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
if (conn.State == ConnectionState.Closed) conn.Open();

//where pm_id=@Payid
// string id = Request.QueryString["id"].ToString();
string str = "update tblCustomerMaster set cust_payment_due=cust_payment_due-" + Session["Amount"] + " where cust_id=" + Session["SupplierId"] + " ";
SqlCommand com = new SqlCommand(str, conn);
com.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}
}
}

//*Code for Insert the forms values into the Table*//
private void insertPaymentSent()
{
using (SqlConnection PaymentConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
PaymentConn.Open();
SqlCommand PaymantCom = new SqlCommand("insert_tblPaymentReceived", PaymentConn);
PaymantCom.CommandType = CommandType.StoredProcedure;
PaymantCom.Parameters.Add(new SqlParameter("@cust_id", Session["SupplierId"].ToString()));
PaymantCom.Parameters.Add(new SqlParameter("@invoice_no", lblInvoiceNo.Text));
string StrDate = lblDate.Text.Substring(3, 2) + "/" + lblDate.Text.Substring(0, 2) + "/" + lblDate.Text.Substring(6, 4);
PaymantCom.Parameters.Add(new SqlParameter("@pr_date", StrDate.ToString()));
PaymantCom.Parameters.Add(new SqlParameter("@pmode_id", Session["ModeId"].ToString()));
PaymantCom.Parameters.Add(new SqlParameter("@pr_amount", lblAmount.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pr_currency", lblcurrency1.Text));

PaymantCom.Parameters.Add(new SqlParameter("@bank_id", Session["BankId"].ToString()));
PaymantCom.Parameters.Add(new SqlParameter("@pr_bank_micr", lblMICRCode.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pr_instrument_no", lblInstrumentNo.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pr_bank_branch", lblBankBranch.Text));
string StrInstrDate = lblInstrumentDate.Text.Substring(3, 2) + "/" + lblInstrumentDate.Text.Substring(0, 2) + "/" + lblInstrumentDate.Text.Substring(6, 4);
PaymantCom.Parameters.Add(new SqlParameter("@pr_instrument_date", StrInstrDate.ToString()));

string ModeRealisation = Session["ModeRealisation"].ToString();
if (ModeRealisation == "Auto")
{
PaymantCom.Parameters.Add(new SqlParameter("@pr_cheque_status", "Realised"));
}
else if (ModeRealisation == "Manual")
{
PaymantCom.Parameters.Add(new SqlParameter("@pr_cheque_status", "UnRealised"));
}

//PaymantCom.Parameters.Add(new SqlParameter("@pr_cheque_status", "Yes"));
PaymantCom.Parameters.Add(new SqlParameter("@pr_created_by", int.Parse(Session["EmpID"].ToString())));
PaymantCom.Parameters.Add(new SqlParameter("@pr_delete", "No"));

//PaymantCom.Parameters.Add(new SqlParameter("@pm_active", "Yes"));

// PaymantCom.Parameters.Add(new SqlParameter("@pm_instrument_date", txtInstrumentDate.Text));
PaymantCom.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
PaymentConn.Close();
}

}

}
private void UpdateRecInvoiceMaster()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
if (conn.State == ConnectionState.Closed) conn.Open();

//where pm_id=@Payid
string strInvoice = lblInvoiceNo.Text;
ArrayList arrInvoice = new ArrayList();
string[] strInvoiceName = strInvoice.Split(',');
if (strInvoiceName.Length > 0)
{
for (int i = 0; i < strInvoiceName.Length; i++)
{
//arrInvoice.Add(strInvoiceName[i].ToString());
//Response.Write(strInvoiceName[i].ToString()+ "---");
string str = "update tblInvoiceMaster set inv_paid='Yes' where inv_no='" + strInvoiceName[i].ToString() + "' ";
SqlCommand com = new SqlCommand(str, conn);
com.ExecuteNonQuery();
}
}


}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}
}
}
}

Monday, November 16, 2009

Login !!

using rangtarang.Connection;


public partial class adminindex : System.Web.UI.Page
{
GetConnection objCon = new GetConnection();
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
txtuser.Focus();
}

}
protected void imgbtn_Click(object sender, ImageClickEventArgs e)
{
Login();
}

private void Login()
{
try
{
if (objCon.sqlConn.State == ConnectionState.Closed)
{
objCon.OpenConnection();
}

SqlCommand sqlquery = new SqlCommand("select * from tblAdmin where login_id='" + txtuser.Text + "' And login_pwd='" + txtpwd.Text + "' And login_active=1", objCon.sqlConn);
SqlDataReader loginReader = sqlquery.ExecuteReader();
if (loginReader.HasRows)
{
loginReader.Read();
if (loginReader["login_id"].ToString() == txtuser.Text && loginReader["login_pwd"].ToString() == txtpwd.Text)
{
lblerror.Visible = false;
Session["LoginId"] = loginReader["login_id"].ToString();
Session["AdminId"] = loginReader["login_pwd"].ToString();
Session["adminVALIDUSER"] = "true";
Session["AdminName"] = loginReader["admin_name"].ToString();
Session.Timeout = 30;
Response.Redirect("adminHome.aspx");
}
}
else
{
lblerror.Visible = true;
lblerror.ForeColor = System.Drawing.Color.Red;
lblerror.Text = "Invalid login-id or password !";
}
}
catch (Exception ex)
{
lblerror.Visible = true;
lblerror.ForeColor = System.Drawing.Color.Red;
lblerror.Text = "Error:" + ex.Message;
}
}
}

Master_Login !!

public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["adminVALIDUSER"] == null)
{
Response.Redirect("adminindex.aspx");
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1500;
Response.CacheControl = "no-cache";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);

Session.Abandon();

Session["AdminId"] = null;
Session["LoginId"] = null;
Session["adminVALIDUSER"] = null;
Session["AdminName"] = null;
Response.Redirect("adminindex.aspx");

}
}

WebConfig !!

appSettings>

add key="rangadmin" value="server=devesh;database=RAngTarang;Integrated Security=SSPI"/>
add key="VideoPath" value="videouploads">
/appSettings>

EditCompany !!

public partial class EditCompany : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
selectCompDetails();
insertContPerDetail();
//addCountry();
}
private void selectCompDetails()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
conn.Open();
string id=Request.QueryString["id"].ToString();
string str = "select * from tblCompanyMaster where comp_id="+id+"";
SqlCommand com = new SqlCommand(str,conn);
SqlDataReader dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
txtCompName.Text = dr["comp_name"].ToString();
txtaddr1.Text = dr["comp_addr1"].ToString();
txtaddr2.Text = dr["comp_addr2"].ToString();
txtPin.Text = dr["comp_city"].ToString();
DDState.SelectedItem.Text =dr["comp_state"].ToString();
DDCountry.SelectedIndex = DDCountry.Items.IndexOf(DDCountry.Items.FindByValue(dr["comp_country"].ToString()));
txtPin.Text = dr["comp_pin"].ToString();
txtCompPhone.Text = dr["comp_phone"].ToString();
txtCompMobile.Text = dr["comp_mobile"].ToString();
txtCompFax.Text = dr["comp_fax"].ToString();
txtCompEmail.Text = dr["comp_email"].ToString();
txtWebsit.Text = dr["comp_website"].ToString();
txtVatNo.Text = dr["comp_vat_no"].ToString();
txtTin_CstNo.Text = dr["comp_tin_cst_no"].ToString();
}


}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}

}

}
private void insertContPerDetail()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
conn.Open();

string str = "select * from tblEmployeeMaster where emp_id=" + DDName.SelectedValue.ToString() + "";
SqlCommand insertCom = new SqlCommand(str, conn);
SqlDataReader dr = insertCom.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
txtContPersName.Text = dr["emp_name"].ToString();
txtDesi.Text = dr["emp_designation"].ToString();
txtCPPhone.Text = dr["emp_phone"].ToString(); ;
txtCPMobile.Text = dr["emp_mobile"].ToString(); ;
txtCPFax.Text = dr["emp_fax"].ToString(); ;
txtCPEmail.Text = dr["emp_email"].ToString(); ;

}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}
}

}
private void addCountry()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
DDCountry.Items.Clear();
conn.Open();
string str = "select country_name,country_id from tblCountryMaster";
ListItem Locat;
SqlCommand insertCom = new SqlCommand(str, conn);
SqlDataReader userReader = insertCom.ExecuteReader();
if (userReader.HasRows)
{
while (userReader.Read())
{
ListItem insert;
insert = new ListItem(userReader["country_name"].ToString(), userReader["country_id"].ToString());
DDCountry.Items.Add(insert);

}
}

Locat = new ListItem("Select--------------------->");
DDCountry.Items.Insert(0, Locat);
userReader.Close();

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}

}

}
protected void tbSubmit_Click(object sender, EventArgs e)
{

}
}

AddPaymentSent !!

public partial class AddPaymentsSent : System.Web.UI.Page
{
ListItem lstInvoice;
IDLDPLMain objIDLDPLMain = new IDLDPLMain();
DynMenu objDynMenu = new DynMenu();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
txtDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
if (Request.QueryString.HasKeys())
{
if (Request.QueryString["Action"] == "Edit")
{
lblPaymentSent.Text = "edit payment sent ";
objIDLDPLMain.AddlogDetails("Edit Payment Sent", Request.Url.ToString());
btnSubmit.Visible = false;
btnSubmit.Text = "Save";
SupplierName();
ModeName();
BankName();
// SelectInvoiceNoForEdit();
FillPaymentDetail();
// SelectInvoiceNoForEdit();

}
else if (Request.QueryString["action"] == "Copy")
{
lblPaymentSent.Text = "copy payment sent ";
objIDLDPLMain.AddlogDetails("Copy Payment Sent", Request.Url.ToString());
BtnSave.Visible = false;
SupplierName();
ModeName();
BankName();
FillPaymentDetail();
}
}
else
{
if (!Page.IsPostBack)
{
if (objDynMenu.PermissionOk("add", "Accounts", "Payment Sent") == "Yes")
{
objIDLDPLMain.AddlogDetails("New Payment Sent", Request.Url.ToString());
BtnSave.Visible = false;
SupplierName();
ModeName();
BankName();
}
else
{
Response.Redirect("adminhome.aspx");
}
}
}
}
}

//Code for Filling The Page For Edit and copy//
private void FillPaymentDetail()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
conn.Open();
string id = Request.QueryString["id"].ToString();
string str = "select * from viewPaymentMade where pm_id="+id+"";
//string str = "select * from viewPaymentMade where supl_id=@Payid ";
SqlCommand com = new SqlCommand(str, conn);
//DataSet ds=new DataSet();
//SqlParameter PAYID = new SqlParameter("@Payid", SqlDbType.Int, 4);
//PAYID.Value = Request.QueryString["id"];
//com.Parameters.Add(PAYID);

SqlDataReader dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
DDLSupplierName.SelectedIndex = DDLSupplierName.Items.IndexOf(DDLSupplierName.Items.FindByText(dr["supl_name"].ToString()));
Session["Supl_id"] = dr["supl_id"].ToString();
// SelectInvoiceNoForEdit();
Session["InvoiceNo"] = dr["supl_invoice_no"].ToString();
DisplayInvoice(dr["supl_invoice_no"].ToString());
chkboxlistInvoice.SelectedValue = dr["supl_invoice_no"].ToString();
Session["InvoiceId"] = dr["supl_invoice_no"].ToString();
//ltboxInvoiceNo.Text = dr["supl_invoice_no"].ToString();
txtDate.Text = dr["progDate"].ToString();
DDLMode.SelectedIndex = DDLMode.Items.IndexOf(DDLMode.Items.FindByValue(dr["pmode_id"].ToString()));
DDLMode.SelectedValue = dr["pmode_id"].ToString();

Session["ChequeStatus"] = dr["pm_cheque_status"].ToString();

txtAmount.Text = dr["pm_amount"].ToString();
lblCurrency.Text = dr["pm_currency"].ToString();
// DDLBankName.SelectedIndex = DDLBankName.Items.IndexOf(DDLBankName.Items.FindByValue(dr["bank_id"].ToString()));
DDLBankName.SelectedValue = dr["bank_id"].ToString();
txtMICRCode.Text = dr["pm_bank_micr"].ToString();
txtBankBranch.Text = dr["pm_bank_branch"].ToString();
txtInstrumentNo.Text = dr["pm_instrument_no"].ToString();
txtInstrumentDate.Text = dr["progDateInstrument"].ToString();
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}
}
}
//*Code for Filling Supplier DropDown List with Suppliers Name*//

private ArrayList GetInvoiceNo(string strInvoice)
{
ArrayList arrInvoice = new ArrayList();
string[] strInvoiceName = strInvoice.Split(',');

if (strInvoiceName.Length > 0)
{
for (int i = 0; i < strInvoiceName.Length; i++)
{
arrInvoice.Add(strInvoiceName[i].ToString());
}
}
return arrInvoice;
}

private void DisplayInvoice(string strInvoice)
{

chkboxlistInvoice.DataSource = GetInvoiceNo(strInvoice);
chkboxlistInvoice.DataBind();
CheckAll();

}

private void CheckAll()
{
foreach (ListItem list in chkboxlistInvoice.Items)
{
list.Selected = true;
}
}

private void SupplierName()
{
using (SqlConnection SuppConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
DDLSupplierName.Items.Clear();
SuppConn.Open();
string suppstr = "select supl_id,supl_name from tblSupplierMaster where supl_active='Yes' and supl_delete='No'";
SqlCommand SuppCom = new SqlCommand(suppstr, SuppConn);
SqlDataReader SuppDR = SuppCom.ExecuteReader();
if (SuppDR.HasRows)
{
ListItem insertSuppName;
while (SuppDR.Read())
{
insertSuppName = new ListItem(SuppDR["supl_name"].ToString(), SuppDR["supl_id"].ToString());
DDLSupplierName.Items.Add(insertSuppName);
}
insertSuppName = new ListItem("Select--------------------->");
DDLSupplierName.Items.Insert(0, insertSuppName);
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
SuppConn.Close();
}
}
}

//*Code for Filling Bank DropDown List with Bank Name*//
private void BankName()
{
using (SqlConnection SuppConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
DDLBankName.Items.Clear();
SuppConn.Open();
string suppstr = "select bank_id,bank_name from tblBankMaster where bank_active='Yes' and bank_delete='No'";
SqlCommand SuppCom = new SqlCommand(suppstr, SuppConn);
SqlDataReader SuppDR = SuppCom.ExecuteReader();
if (SuppDR.HasRows)
{
ListItem insertSuppName;
while (SuppDR.Read())
{
insertSuppName = new ListItem(SuppDR["bank_name"].ToString(), SuppDR["bank_id"].ToString());
DDLBankName.Items.Add(insertSuppName);
}
insertSuppName = new ListItem("Select--------------------->");
DDLBankName.Items.Insert(0, insertSuppName);
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
SuppConn.Close();
}
}
}

//*Code for Filling Mode DropDown List with Mode Name*//
private void ModeName()
{
using (SqlConnection SuppConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
DDLMode.Items.Clear();
SuppConn.Open();
string suppstr = "select pmode_id,pmode_name from tblPaymentMode where pmode_active='Yes' and pmode_delete='No'";
SqlCommand SuppCom = new SqlCommand(suppstr, SuppConn);
SqlDataReader SuppDR = SuppCom.ExecuteReader();
if (SuppDR.HasRows)
{
ListItem insertSuppName;
while (SuppDR.Read())
{
insertSuppName = new ListItem(SuppDR["pmode_name"].ToString(), SuppDR["pmode_id"].ToString());
DDLMode.Items.Add(insertSuppName);
}
insertSuppName = new ListItem("Select--------------------->");
DDLMode.Items.Insert(0, insertSuppName);
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
SuppConn.Close();
}
}
}
//*Code for Gating the Currency Name *//
private void CurrencyName()
{
using (SqlConnection SuppConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
// DDLBankName.Items.Clear();
//DDLMode.Items.Clear();
SuppConn.Open();
//where supl_active='Yes' and supl_delete='No'
if (DDLSupplierName.SelectedValue.ToString() != "Select--------------------->")
{
string suppstr = "select * from viewSupplierCurrencyForPaySent where supl_id=" + DDLSupplierName.SelectedValue.ToString() + "";

SqlCommand SuppCom = new SqlCommand(suppstr, SuppConn);
SqlDataReader SuppDR = SuppCom.ExecuteReader();
if (SuppDR.HasRows)
{

while (SuppDR.Read())
{
lblCurrency.Text = SuppDR["currency_name"].ToString();
Session["CurrencyId"] = SuppDR["currency_id"].ToString();
}

}
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
SuppConn.Close();
}
}
}
//*Code for Insert the Forms values into the Table*//
private void insertPaymentSent()
{
using (SqlConnection PaymentConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
PaymentConn.Open();
SqlCommand PaymantCom = new SqlCommand("insert_tblPaymentMade", PaymentConn);
PaymantCom.CommandType = CommandType.StoredProcedure;
PaymantCom.Parameters.Add(new SqlParameter("@supl_id", DDLSupplierName.SelectedValue.ToString()));
//PaymantCom.Parameters.Add(new SqlParameter("@supl_invoice_no", ltboxInvoiceNo.Text));
string StrDate = txtDate.Text.Substring(3, 2) + "/" + txtDate.Text.Substring(0, 2) + "/" + txtDate.Text.Substring(6, 4);
PaymantCom.Parameters.Add(new SqlParameter("@pm_date", StrDate.ToString()));
PaymantCom.Parameters.Add(new SqlParameter("@pmode_id", DDLMode.SelectedValue ));
PaymantCom.Parameters.Add(new SqlParameter("@pm_amount", txtAmount.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pm_currency", lblCurrency.Text));
PaymantCom.Parameters.Add(new SqlParameter("@bank_id", DDLBankName.SelectedValue.ToString()));
PaymantCom.Parameters.Add(new SqlParameter("@pm_bank_micr", txtMICRCode.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pm_instrument_no", txtInstrumentNo.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pm_bank_branch", txtBankBranch.Text));
string StrInstrDate = txtDate.Text.Substring(3, 2) + "/" + txtDate.Text.Substring(0, 2) + "/" + txtDate.Text.Substring(6, 4);
PaymantCom.Parameters.Add(new SqlParameter("@pm_instrument_date", StrInstrDate.ToString()));

PaymantCom.Parameters.Add(new SqlParameter("@pm_cheque_status","Unrealised"));
PaymantCom.Parameters.Add(new SqlParameter("@pm_created_by", 2));
PaymantCom.Parameters.Add(new SqlParameter("@pm_active", "Yes"));
PaymantCom.Parameters.Add(new SqlParameter("@pm_delete", "No"));
// PaymantCom.Parameters.Add(new SqlParameter("@pm_instrument_date", txtInstrumentDate.Text));
PaymantCom.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
PaymentConn.Close();
}
}
}

protected void btnCancel_click(object sender, EventArgs e)
{
if (Request.QueryString.HasKeys())
{
Response.Redirect("viewpaymentsent.aspx");
}
else
{
Response.Redirect("adminhome.aspx");
}
}
protected void btnSubmit_click(object sender, EventArgs e)
{

//insertPaymentSent();
//Response.Redirect("paymentsentdetail.aspx");
}

//*Code for update the paymentsent*//
private void UpdatePaymentSent()
{
string InvoiceEdit=String.Empty;
using (SqlConnection PaymentConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
PaymentConn.Open();
SqlCommand PaymantCom = new SqlCommand("update_tblPaymentMade", PaymentConn);
PaymantCom.CommandType = CommandType.StoredProcedure;
PaymantCom.Parameters.Add(new SqlParameter("@pm_id", Request.QueryString["id"]));
PaymantCom.Parameters.Add(new SqlParameter("@supl_id", DDLSupplierName.SelectedValue.ToString()));
string InvoiceNo = Session["InvoiceId"].ToString();
foreach (ListItem list in chkboxlistInvoice.Items)
{

InvoiceEdit = list.Text + "," + InvoiceEdit.ToString();
}
InvoiceEdit = InvoiceEdit.ToString().Substring(0, InvoiceEdit.ToString().Length-1);

//Session["InvoiceNo"] = Session["InvoiceNo"].ToString().Substring(0,Session["InvoiceNo"].ToString().Length-1);
PaymantCom.Parameters.Add(new SqlParameter("@supl_invoice_no", InvoiceEdit));

string StrDate = txtDate.Text.Substring(3, 2) + "/" + txtDate.Text.Substring(0, 2) + "/" + txtDate.Text.Substring(6, 4);
PaymantCom.Parameters.Add(new SqlParameter("@pm_date", StrDate.ToString()));
PaymantCom.Parameters.Add(new SqlParameter("@pmode_id", DDLMode.SelectedValue));
PaymantCom.Parameters.Add(new SqlParameter("@pm_amount", txtAmount.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pm_currency", lblCurrency.Text));
PaymantCom.Parameters.Add(new SqlParameter("@bank_id", DDLBankName.SelectedValue.ToString()));
PaymantCom.Parameters.Add(new SqlParameter("@pm_bank_micr", txtMICRCode.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pm_instrument_no", txtInstrumentNo.Text));
PaymantCom.Parameters.Add(new SqlParameter("@pm_bank_branch", txtBankBranch.Text));
string StrInstrDate = txtDate.Text.Substring(3, 2) + "/" + txtDate.Text.Substring(0, 2) + "/" + txtDate.Text.Substring(6, 4);
PaymantCom.Parameters.Add(new SqlParameter("@pm_instrument_date", StrInstrDate.ToString()));


//Session["ModeRealisatin"]=DDLMode.SelectedValue;

//if (DDLMode.SelectedIndex <=0 )
//{
// PaymantCom.Parameters.Add(new SqlParameter("@pm_cheque_status",DDLMode.SelectedValue));
//}
// string ModeRealisation = Session["ModeRealisation"].ToString();
if (Session["ModeRealisation"] == null)
{
PaymantCom.Parameters.Add(new SqlParameter("@pm_cheque_status", Session["ChequeStatus"].ToString()));
}
else
{
string ModeRealisation = Session["ModeRealisation"].ToString();
if (ModeRealisation == "Auto")
{
PaymantCom.Parameters.Add(new SqlParameter("@pm_cheque_status", "Realised"));
}
else if (ModeRealisation == "Manual")
{
PaymantCom.Parameters.Add(new SqlParameter("@pm_cheque_status", "UnRealised"));
}
}
// PaymantCom.Parameters.Add(new SqlParameter("@pm_cheque_status", "Yes"));
PaymantCom.Parameters.Add(new SqlParameter("@pm_edit_by", 2));
PaymantCom.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
PaymentConn.Close();
}
}

}
protected void DDLBankName_SelectedIndexChanged(object sender, EventArgs e)
{
BankMICRCode();
}
//*Code for Get the Bank's MICR*//
private void BankMICRCode()
{
using (SqlConnection BankMICRConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{

BankMICRConn.Open();
txtMICRCode.Text = "";
if (DDLBankName.SelectedValue.ToString() != "Select--------------------->")
{
string BankMICRstr = "select bank_micr from tblBankMaster where bank_id=" + DDLBankName.SelectedValue.ToString() + " and bank_active='Yes' and bank_delete='No'";
SqlCommand BankMICRCom = new SqlCommand(BankMICRstr, BankMICRConn);
SqlDataReader BankMICRDR = BankMICRCom.ExecuteReader();
if (BankMICRDR.HasRows)
{
BankMICRDR.Read();
txtMICRCode.Text = BankMICRDR["bank_micr"].ToString();
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
BankMICRConn.Close();
}
}
}
protected void DDLSupplierName_SelectedIndexChanged(object sender, EventArgs e)
{
SelectInvoiceNo();
CurrencyName();
}

//*Code for Get the Inventory No*//
private void SelectInvoiceNo()
{
using (SqlConnection BankMICRConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{

chkboxlistInvoice.Items.Clear();
if (DDLSupplierName.SelectedValue.ToString() != "Select--------------------->")
{
BankMICRConn.Open();
string BankMICRstr = "select rinv_no,supl_id from tblRecInvoice where rinv_paid='No' and supl_id=" + DDLSupplierName.SelectedValue.ToString() + " ";
SqlCommand BankMICRCom = new SqlCommand(BankMICRstr, BankMICRConn);
SqlDataReader BankMICRDR = BankMICRCom.ExecuteReader();
if (BankMICRDR.HasRows)
{
ListItem insertSuppName;
while (BankMICRDR.Read())
{
insertSuppName = new ListItem(BankMICRDR["rinv_no"].ToString(), BankMICRDR["supl_id"].ToString());
chkboxlistInvoice.Items.Add(insertSuppName);
}
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
BankMICRConn.Close();
}
}
}

//*Code for Get the Inventory No for Edit*//
private void SelectInvoiceNoForEdit()
{
using (SqlConnection BankMICRConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
chkboxlistInvoice.Items.Clear();

BankMICRConn.Open();
string BankMICRstr = "select rinv_no,supl_id from tblRecInvoice where supl_id=" + Session["Supl_id"].ToString() + " ";
SqlCommand BankMICRCom = new SqlCommand(BankMICRstr, BankMICRConn);
SqlDataReader BankMICRDR = BankMICRCom.ExecuteReader();
if (BankMICRDR.HasRows)
{
ListItem insertSuppName;
while (BankMICRDR.Read())
{
insertSuppName = new ListItem(BankMICRDR["rinv_no"].ToString(), BankMICRDR["supl_id"].ToString());
//ltboxInvoiceNo.Items.Add(insertSuppName);
chkboxlistInvoice.Items.Add(insertSuppName);
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
BankMICRConn.Close();
}
}
}
protected void BtnSave_click(object sender, EventArgs e)
{
UpdatePaymentSent();
Response.Redirect("viewpaymentsent.aspx");
}
protected void DDLMode_SelectedIndexChanged(object sender, EventArgs e)
{
ModeRealisation();
}
//*Code for Gating the ModeRealisation Name *//
private void ModeRealisation()
{
using (SqlConnection SuppConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
SuppConn.Open();
//where supl_active='Yes' and supl_delete='No' tblPaymentMode ,pmode_realisation
if (DDLMode.SelectedValue.ToString() != "Select--------------------->")
{
string suppstr = "select * from tblPaymentMode where pmode_id=" + DDLMode.SelectedValue.ToString() + "";
SqlCommand SuppCom = new SqlCommand(suppstr, SuppConn);
SqlDataReader SuppDR = SuppCom.ExecuteReader();
if (SuppDR.HasRows)
{
SuppDR.Read();
Session["ModeRealisation"] = SuppDR["pmode_realisation"].ToString();
}
}

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
SuppConn.Close();
}
}
}

//*Code for Deleting record for Edit *//
private void DeleteRecForEditInvoiceNo()
{
using (SqlConnection SuppConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{

SuppConn.Open();
//where supl_active='Yes' and supl_delete='No' tblPaymentMode ,pmode_realisation
string suppstr = "Delete tblPaymentMade where pm_id="+Request.QueryString["id"]+"";
SqlCommand SuppCom = new SqlCommand(suppstr, SuppConn);
SuppCom.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
SuppConn.Close();
}
}
}

}

ViewPaymentSent !!

public partial class viewpaymentsent : System.Web.UI.Page
{
private const string ASCENDING = " ASC";
private const string DESCENDING = " DESC";
string _Strfill;
IDLDPLMain objIDLDPLMain = new IDLDPLMain();
string strPayOperation = String.Empty;
string strPayApprove = String.Empty;
DynMenu objDynMenu = new DynMenu();

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
objIDLDPLMain.AddlogDetails("View Payment Sent", Request.Url.ToString());
fillviewPayment();
}

}
//*Code for Fill The GridView*//
private void fillviewPayment()
{
using (SqlConnection ViewPayconn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
ViewPayconn.Open();
string viewpaymentstr;
if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
viewpaymentstr = "select * from viewPaymentMadeNew where pm_delete='No' order by pm_id desc";
}
else
{
viewpaymentstr = "select * from viewPaymentMade where pm_delete='No' AND (loc_id = " + Session["loglocid"] + ") order by pm_id desc";
}
SqlDataAdapter viewPayDA = new SqlDataAdapter(viewpaymentstr, ViewPayconn);
DataSet ds = new DataSet();
viewPayDA.Fill(ds,"tmptable");


if (ds.Tables["tmptable"].Rows.Count == 0)
{
gviewPaymentSent.Visible = false;
hidetr.Visible = true;
EmptyMsg.Visible = true;
}
else
{
gviewPaymentSent.Visible = true;
EmptyMsg.Visible = false;
hidetr.Visible = false;
gviewPaymentSent.DataSource = ds;
gviewPaymentSent.DataBind();
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
ViewPayconn.Close();
}
}
}

//*Below 4 function ( code ) are used for Sorting*//
private void SortGridView(string sortExpression, string direction)
{
// You can cache the DataTable for improving performance
DataTable dt = GetData().Tables[0];
DataView dv = new DataView(dt);

dv.Sort = sortExpression + direction;

gviewPaymentSent.DataSource = dv;
gviewPaymentSent.DataBind();

}
private DataSet GetData()
{

SqlConnection StWConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]);

//SqlDataAdapter ad = new SqlDataAdapter("SELECT * from emplistview where emp_delete='No' order by emp_id desc", StWConn);
SqlDataAdapter ad;

if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
ad = new SqlDataAdapter("select * from viewPaymentMadeNew where pm_delete='No' order by pm_id desc", StWConn);
}
else
{
ad = new SqlDataAdapter("select * from viewPaymentMade where pm_delete='No' AND (loc_id = " + Session["loglocid"] + ") order by pm_id desc", StWConn);
}
DataSet ds = new DataSet();

ad.Fill(ds);

return ds;

}
public SortDirection GridViewSortDirection
{
get
{
if (ViewState["sortDirection"] == null)
ViewState["sortDirection"] = SortDirection.Ascending;
else
ViewState["sortDirection"] = SortDirection.Descending;
return (SortDirection)ViewState["sortDirection"];
}
set { ViewState["sortDirection"] = value; }
}
protected void gviewPaymentSent_Sorting(object sender, GridViewSortEventArgs e)
{
{
string sortExpression = e.SortExpression;

if (GridViewSortDirection == SortDirection.Ascending)
{
GridViewSortDirection = SortDirection.Descending;
SortGridView(sortExpression, DESCENDING);
}
else
{
GridViewSortDirection = SortDirection.Ascending;
SortGridView(sortExpression, ASCENDING);
ViewState["sortDirection"] = null;
}
}
}
protected void gviewPaymentSent_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gviewPaymentSent.PageIndex = e.NewPageIndex;
fillviewPayment();
}
protected void gviewPaymentSent_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Separator)
{
Label lblstatus = (Label)e.Row.Cells[9].FindControl("lblActive");
Label lblid = (Label)e.Row.Cells[9].FindControl("lblID");
Label lblDel = (Label)e.Row.Cells[9].FindControl("lblDel");


string status = lblstatus.Text.ToString();
string id = lblid.Text.ToString();

// \"Click Realised
// \"Click UnRealised

strPayOperation = objDynMenu.GetPermission("Accounts", "Payment Sent");


//////////////////////////Begin Approval Permission//////////////////////////////
if (strPayOperation.Length.ToString() != "0")
{
strPayOperation = strPayOperation.ToString().Substring(0, strPayOperation.Length - 1);
ArrayList myList = new ArrayList();
char[] sep ={ ',' };

string[] values = strPayOperation.Split(sep);

int i;
for (i = 0; i < values.Length; i++)
{
myList.Add(values[i]);
if (values[i].ToString().ToLower() == "approve")
{
strPayApprove = "approve";
break;
}
}
}


if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
if (status.ToString() == "Realised")
{
e.Row.Cells[7].Text = "\"Click";
}
else
{
e.Row.Cells[7].Text = "\"Click";
}
}
else if (strPayApprove.ToString() == "approve")
{
if (status.ToString() == "Realised")
{
e.Row.Cells[7].Text = "\"Click";
}
else
{
e.Row.Cells[7].Text = "\"Click";
}
}
else
{
if (status.ToString() == "Realised")
{
e.Row.Cells[7].Text = "\"Click";
}
else
{
e.Row.Cells[7].Text = "\"Click";
}
}
//////////////////////////End Approval Permission//////////////////////////////


////////////////Begin Delete Permissions////////////////////////
if (strPayOperation.Length.ToString() != "0")
{
strPayOperation = strPayOperation.ToString().Substring(0, strPayOperation.Length - 1);
ArrayList myList = new ArrayList();
char[] sep ={ ',' };
string[] values = strPayOperation.Split(sep);
int i;
for (i = 0; i < values.Length; i++)
{
myList.Add(values[i]);
if (values[i].ToString().ToLower() == "Delete")
{
lblDel.Text="";
break;
}
else if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
lblDel.Text = "";
}
else
{
lblDel.Text = "";
}
}
}
else if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
lblDel.Text = "";
}
else
{
lblDel.Text = "";
}
/////////////////End Delete Permissions///////////////////////
}
}
protected void BtnSubmit_click(object sender, EventArgs e)
{
Search();
}

//* Code for Search*//
private void Search()
{
using (SqlConnection ViewPayconn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
ViewPayconn.Open();
if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
_Strfill = "select * from viewPaymentMadeNew ";
}
else
{
_Strfill = "select * from viewPaymentMade ";
}
string serkey;
serkey = txtSearch.Text;
if (txtSearch.Text != "")
{
if (DDLSearch.SelectedValue != "Select")
{
if (DDLSearch.SelectedValue == "Supplier Name")
{
// _Strfill = _Strfill + " where supl_name like '%" + serkey.ToString() + "%'";
if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
_Strfill = _Strfill + " where supl_name = '" + serkey.ToString() + "'";
}
else
{
_Strfill = _Strfill + " where supl_name = '" + serkey.ToString() + "' AND (loc_id = " + Session["loglocid"] + ")";
}
}
else if (DDLSearch.SelectedValue == "Date")
{
if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
_Strfill = _Strfill + " where progDate='" + serkey.ToString() + "'";
}
else
{
_Strfill = _Strfill + " where progDate='" + serkey.ToString() + "' AND (loc_id = " + Session["loglocid"] + ")";
}
}
else if (DDLSearch.SelectedValue == "Mode")
{
if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
_Strfill = _Strfill + " where pmode_name='" + serkey.ToString() + "'";
}
else
{
_Strfill = _Strfill + " where pmode_name='" + serkey.ToString() + "' AND (loc_id = " + Session["loglocid"] + ")";
}
}
else if (DDLSearch.SelectedValue == "Currency")
{
if (Session["logLevelName"].ToString().Trim().ToLower() == "admin")
{
_Strfill = _Strfill + " where pm_Currency='" + serkey.ToString() + "'";
}
else
{
_Strfill = _Strfill + " where pm_Currency='" + serkey.ToString() + "' AND (loc_id = " + Session["loglocid"] + ")";
}
}

}
}
// _Strfill = _Strfill + " order by pm_id desc";
PopulateSearchGrid(_Strfill);

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
ViewPayconn.Close();
}
}
}

public void PopulateSearchGrid(string StrKey)
{
try
{
using (SqlConnection IDLDPLConn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
IDLDPLConn.Open();
SqlDataAdapter IDLDPLda = new SqlDataAdapter(StrKey.ToString(), IDLDPLConn);
DataSet IDLDPLds = new DataSet();
IDLDPLda.Fill(IDLDPLds,"Temp");
if (IDLDPLds.Tables["Temp"].Rows.Count == 0)
{
gviewPaymentSent.Visible = false;
hidetr.Visible = true;
EmptyMsg.Visible = true;
}
else
{
gviewPaymentSent.Visible = true;
EmptyMsg.Visible = false;
hidetr.Visible = false;
gviewPaymentSent.DataSource = IDLDPLds;
gviewPaymentSent.DataBind();
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
}

}

AddLocation !!

protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString.HasKeys())
{
if (Request.QueryString["action"].ToString() == "edit")
{
if (!Page.IsPostBack)
{
lblLocation.Text = "Edit Location";
btnSubmit.Text = "Save";
addLocType();
addCompName();
addCountry();
FillLocationDetail();

}
}
else if (Request.QueryString["action"].ToString() == "copy")
{
if (!Page.IsPostBack)
{
lblLocation.Text = "Copy Location";
btnSubmit.Text = "Save";
addLocType();
addCompName();
addCountry();
FillLocationDetail();
//addCountry();
}


}
}
else
{
if (!Page.IsPostBack)
{
addLocType();
addCompName();
addCountry();
}
}
}

######################################

// Add Company Location Type

private void addLocType()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
DDCountry.Items.Clear();
conn.Open();
string str = "select loc_type_name,loc_type_id from tblLocationType where loc_type_active='Yes' and loc_type_delete='No'";
ListItem Locat;
SqlCommand insertCom = new SqlCommand(str, conn);
SqlDataReader userReader = insertCom.ExecuteReader();
if (userReader.HasRows)
{
while (userReader.Read())
{
ListItem insert;
insert = new ListItem(userReader["loc_type_name"].ToString(), userReader["loc_type_id"].ToString());
DDLocation.Items.Add(insert);

}
}

Locat = new ListItem("Select--------------------->");
DDLocation.Items.Insert(0, Locat);
userReader.Close();

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}

}

}

##########################################

// Add Company Name

private void addCompName()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
DDCountry.Items.Clear();
conn.Open();
string str = "select comp_name,comp_id from tblCompanyMaster where comp_active='Yes' and comp_delete='No'";
ListItem Locat;
SqlCommand insertCom = new SqlCommand(str, conn);
SqlDataReader userReader = insertCom.ExecuteReader();
if (userReader.HasRows)
{
while (userReader.Read())
{
ListItem insert;
insert = new ListItem(userReader["comp_name"].ToString(), userReader["comp_id"].ToString());
DDCompName.Items.Add(insert);

}
}

Locat = new ListItem("Select--------------------->");
DDCompName.Items.Insert(0, Locat);
userReader.Close();

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}

}

}

#######################################

// Add Country
private void addCountry()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
DDCountry.Items.Clear();
conn.Open();
string str = "select country_name,country_id from tblCountryMaster where country_active='Yes'and country_delete='No'";
ListItem Locat;
SqlCommand insertCom = new SqlCommand(str, conn);
SqlDataReader userReader = insertCom.ExecuteReader();
if (userReader.HasRows)
{
while (userReader.Read())
{
ListItem insert;
insert = new ListItem(userReader["country_name"].ToString(), userReader["country_id"].ToString());
DDCountry.Items.Add(insert);

}
}

Locat = new ListItem("Select--------------------->");
DDCountry.Items.Insert(0, Locat);
userReader.Close();

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}

}

}

###################################################

// Add Company Location
private void LocationAdd()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
conn.Open();
SqlCommand comLocation = new SqlCommand("insert_tblLocationMaster", conn);
comLocation.CommandType = CommandType.StoredProcedure;
comLocation.Parameters.Add(new SqlParameter("@comp_id", DDCompName.SelectedValue.ToString()));
comLocation.Parameters.Add(new SqlParameter("@loc_type_id", DDLocation.SelectedValue.ToString()));
comLocation.Parameters.Add(new SqlParameter("@loc_name", txtLocName.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_contect_person", txtContPerson.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_addr1", txtaddr1.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_addr2", txtaddr2.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_city", txtcity.Text));


if (DDState.SelectedItem.Text == "Others")
{
comLocation.Parameters.Add(new SqlParameter("@loc_state", txtother.Text));
}
else
{
comLocation.Parameters.Add(new SqlParameter("@loc_state", DDState.SelectedItem.Text));
}

// comLocation.Parameters.Add(new SqlParameter("@loc_state", DDState.SelectedItem.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_country", DDCountry.SelectedValue.ToString()));
comLocation.Parameters.Add(new SqlParameter("@loc_pin", txtpin.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_phone", txtphone.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_mobile", txtmobile.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_fax", txtfax.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_email", txtemail.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_active", "Yes"));
comLocation.Parameters.Add(new SqlParameter("@loc_delete", "No"));
comLocation.Parameters.Add(new SqlParameter("@loc_add_by", int.Parse(Session["EmpID"].ToString())));
//comLocation.Parameters.Add(new SqlParameter("@loc_add_date", "No"));

comLocation.ExecuteNonQuery();


}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{

}


}


}
private void FillLocationDetail()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
conn.Open();

string id = Request.QueryString["id"].ToString();
// string str = "select * from tblLocationMaster ";
string str = "select * from viewLocationDetail where loc_id=@Locid";


SqlCommand com = new SqlCommand(str, conn);
SqlParameter LOCID = new SqlParameter("@Locid", SqlDbType.Int, 4);
LOCID.Value = Request.QueryString["id"];
com.Parameters.Add(LOCID);
SqlDataReader dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
DDCompName.SelectedIndex = DDCompName.Items.IndexOf(DDCompName.Items.FindByValue(dr["comp_id"].ToString()));
DDLocation.SelectedIndex = DDLocation.Items.IndexOf(DDLocation.Items.FindByValue(dr["loc_type_id"].ToString()));
txtLocName.Text = dr["loc_name"].ToString();
ViewState["locName"] = dr["loc_name"].ToString();

txtContPerson.Text = dr["loc_contect_person"].ToString();
txtaddr1.Text = dr["loc_addr1"].ToString();
txtaddr2.Text = dr["loc_addr2"].ToString();
txtcity.Text = dr["loc_city"].ToString();
// DDState.SelectedItem.Text = dr["loc_state"].ToString();
DDCountry.SelectedIndex = DDCountry.Items.IndexOf(DDCountry.Items.FindByValue(dr["loc_country"].ToString()));
if (DDCountry.SelectedIndex > 0)
{
DDState.SelectedIndex = DDState.Items.IndexOf(DDState.Items.FindByText(dr["loc_state"].ToString()));
if (DDState.SelectedIndex <= 0)
{

txtother.Visible = true;
txtother.Text = dr["loc_state"].ToString();
DDState.SelectedIndex = DDState.Items.Count - 1;

}
}
else
{
txtother.Visible = false;

}
txtpin.Text = dr["loc_pin"].ToString();
txtphone.Text = dr["loc_phone"].ToString();
txtmobile.Text = dr["loc_mobile"].ToString();
txtfax.Text = dr["loc_fax"].ToString();
txtemail.Text = dr["loc_email"].ToString();

}

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{
conn.Close();
}

}

}
/*This code is used for update the LocationDetail*/
private void UpdateLocationDetail()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{
try
{
conn.Open();
SqlCommand comLocation = new SqlCommand("update_tblLocationMaster1", conn);
comLocation.CommandType = CommandType.StoredProcedure;
string id = Request.QueryString["id"].ToString();
comLocation.Parameters.Add(new SqlParameter("@loc_id", id));
comLocation.Parameters.Add(new SqlParameter("@comp_id", DDCompName.SelectedValue.ToString()));
comLocation.Parameters.Add(new SqlParameter("@loc_type_id", DDLocation.SelectedValue.ToString()));
comLocation.Parameters.Add(new SqlParameter("@loc_name", txtLocName.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_contect_person", txtContPerson.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_addr1", txtaddr1.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_addr2", txtaddr2.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_city", txtcity.Text));


if (DDState.SelectedItem.Text == "Others")
{
comLocation.Parameters.Add(new SqlParameter("@loc_state", txtother.Text));
}
else
{
comLocation.Parameters.Add(new SqlParameter("@loc_state", DDState.SelectedItem.Text));
}

// comLocation.Parameters.Add(new SqlParameter("@loc_state", DDState.SelectedItem.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_country", DDCountry.SelectedValue.ToString()));
comLocation.Parameters.Add(new SqlParameter("@loc_pin", txtpin.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_phone", txtphone.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_mobile", txtmobile.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_fax", txtfax.Text));
comLocation.Parameters.Add(new SqlParameter("@loc_email", txtemail.Text));

comLocation.Parameters.Add(new SqlParameter("@loc_edit_by", int.Parse(Session["EmpID"].ToString())));

comLocation.ExecuteNonQuery();

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
finally
{

}


}


}

protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Request.QueryString.HasKeys())
{
if (Request.QueryString["action"].ToString() == "edit")
{
UpdateLocationDetail();
Response.Redirect("viewlocation.aspx");
}
else if (Request.QueryString["action"].ToString() == "copy")
{
checkLocationStauts();

}
}
else
{
checkLocationStauts();
//LocationAdd();
//Response.Redirect("viewlocation.aspx");

}
}
public void checkLocationStauts()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["conIDLDPL"]))
{

try
{
lblmsg.Text = "";
conn.Open();
// string str = "select * from tblLocationMaster where loc_name='" + ViewState["locName"] + "'";
string str = "select * from tblLocationMaster where loc_name='" + txtLocName.Text + "'";
SqlCommand chkCom = new SqlCommand(str,conn);
SqlDataReader dr = chkCom.ExecuteReader();
if (dr.HasRows)
{

dr.Read();
lblmsg.Text="Location name already exists!";
}
else
{
LocationAdd();
Response.Redirect("viewlocation.aspx",false);
//checkLocationStauts();
}
}
catch (Exception ex)
{
Response.Redirect(ex.Message.ToString());
}
finally
{
conn.Close();
}
}


}
protected void btCancle_Click(object sender, EventArgs e)
{
if (Request.QueryString.HasKeys())
{
Response.Redirect("viewlocation.aspx");
}
else
{
Response.Redirect("adminhome.aspx");
}
}
protected void DDState_SelectedIndexChanged(object sender, EventArgs e)
{
if (DDState.SelectedItem.Text == "Others")
{

txtother.Visible = true;
}
else
{
txtother.Visible = false;
}

}
protected void DDCountry_SelectedIndexChanged(object sender, EventArgs e)
{
if (DDCountry.SelectedItem.Text != "India")
{
DDState.SelectedValue = "Others";
txtother.Visible = true;
// lblStar.Visible = true;
this.txtother.Focus();
}
else
{
txtother.Visible = false;
DDState.SelectedValue = DDState.SelectedValue.ToString();
// DDState.SelectedIndex = 0;
// lblStar.Visible = false;

}
}

Reapeter Fill !!

private void fillGridView()
{

string FileDirectory = Server.MapPath("Database/admin.mdb");
OleDbConnection ocon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileDirectory.ToString() + "");

try
{
ocon.Open();
string str = "SELECT Project_master.Project_name,Project_master.Project_id, Project_master.Project_total_hours, Project_master.Project_start_date, Project_master.Project_end_date, User_master.User_name" + " " +
"FROM Project_master INNER JOIN User_master ON Project_master.User_id = User_master.User_id";

//string str = "SELECT Project_assignment.ProjAssig_opening_hours, Project_assignment.ProiAssig_Allolet_hours, Project_assignment.ProjAssig_status, Project_master.Project_name, Project_master.Project_total_hours, Project_master.Project_start_date, Project_master.Project_end_date, User_master.User_name" + " " +
//"FROM Project_assignment INNER JOIN (Project_master INNER JOIN User_master ON Project_master.User_id = User_master.User_id) ON Project_assignment.Project_id = Project_master.Project_id";
//String str = "select *,User_name from Project_master inner join User_Master on Project_master.User_id=User_Master.User_id order by Project_master.Project_end_date desc";
OleDbDataAdapter osap = new OleDbDataAdapter(str, ocon);

DataSet ds = new DataSet();
osap.Fill(ds, "temp");
GVProjectReports.DataSource = ds;
GVProjectReports.DataBind();


}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}

}


private DataSet FillRepeater(string pid)
{

string FileDirectory = Server.MapPath("Database/admin.mdb");
DataSet ds = new DataSet();
OleDbConnection ocon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileDirectory.ToString() + "");

try
{
ocon.Open();
string str = "SELECT User_master.User_name,ProjAssig_opening_hours,ProiAssig_Allolet_hours " + " " +
"FROM Project_assignment INNER JOIN User_master ON User_master.User_id = Project_assignment.User_id where Project_assignment.Project_id="+ pid +" ";

OleDbDataAdapter osap = new OleDbDataAdapter(str, ocon);


osap.Fill(ds, "temp");

}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}

return ds;

}


protected void GVProjectReports_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Separator)
{

Repeater rep = (Repeater)e.Row.FindControl("ProReport");
Label pid=(Label)e.Row.FindControl("projectID");
Label lblTotHr = (Label)e.Row.FindControl("lblTotHr");
Label _lblRemaingHr = (Label)e.Row.FindControl("lblRemaingHr");



rep.DataSource = FillRepeater(pid.Text);
rep.DataBind();
int totalHr = 0;
foreach (RepeaterItem repe in rep.Items)
{
Label lblopenAllocated = (Label)repe.FindControl("lblopenHr");
totalHr = totalHr + Convert.ToInt32(lblopenAllocated.Text);
}

_lblRemaingHr.Text =Convert.ToString((Convert.ToInt32(lblTotHr.Text) - totalHr));

}
}

Update !!

private void updatecom()
{
//using (SqlConnection scon = new SqlConnection(ConfigurationManager.AppSettings["MyCartConnKEy"]))
//{
string FileDirectory = Server.MapPath("Database/admin.mdb");
OleDbConnection ocon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileDirectory.ToString() + "");
//OleDbConnection ocon = new OleDbConnection();
try
{
string status = Request.QueryString["setStatus"].ToString();
string id = Request.QueryString["um_id"].ToString();
ocon.Open();
string str = "update Project_master set Project_status='" + status + "' where Project_id=" + id + "";
// SqlCommand updatecom = new SqlCommand(str, scon);
OleDbCommand ocom = new OleDbCommand(str, ocon);
ocom.ExecuteNonQuery();
Response.Redirect("ViewProject.aspx");

}
catch (OleDbException ex)
{
Response.Write(ex.Message.ToString());

}
finally
{
ocon.Close();

}


//}

}

RowDataBound_ FillGrid !!

protected void GridDisplayCat_RowDataBound(object sender, GridViewRowEventArgs e)
{
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Separator)
{

//Label lbldate = (Label)e.Row.Cells[1].FindControl("lbldate");
// DateTime dt = Convert.ToDateTime(lbldate.Text);
// lbldate.Text = dt.ToString("dd/MM/yyyy");

// Label lblEdate = (Label)e.Row.Cells[1].FindControl("lblEdate");
// DateTime dt1 = Convert.ToDateTime(lblEdate.Text);
// lblEdate.Text = dt1.ToString("dd/MM/yyyy");

Label lblstatus = (Label)e.Row.Cells[1].FindControl("lblstatus");
Label lblid = (Label)e.Row.Cells[2].FindControl("lblid");
string status = lblstatus.Text.ToString();
string id = lblid.Text.ToString();
if (status.ToString() == "Yes")
{
e.Row.Cells[1].Text = "\"Click";
}
else
{
e.Row.Cells[1].Text = "\"Click";
}

}
}

}

Fill Grid !!

private void fillGrid()
{
string FileDirectory = Server.MapPath("Database/admin.mdb");
OleDbConnection ocon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileDirectory.ToString() + "");
//OleDbConnection ocon = new OleDbConnection();
try
{
ocon.Open();
string str = "select *,User_name from (Project_master inner join User_Master on Project_master.User_id=User_Master.User_id ) "+" " +
" inner join Client_master on Project_master.Client_id=Client_master.Client_id order by Project_id desc";
// String str = "select *,User_name from Project_master inner join User_Master on Project_master.User_id=User_Master.User_id order by Project_id desc";
OleDbDataAdapter osap = new OleDbDataAdapter(str, ocon);

DataSet ds = new DataSet();
osap.Fill(ds, "temp");
GridDisplayCat.DataSource = ds;
GridDisplayCat.DataBind();


}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}

}

Edit Procedure !!

CREATE Procedure EditCat
(
@catname Varchar(100),
@catid int
)
AS
update tblMainCat set
Cat_Name=@catname
where cat_id=@catid


GO

UpdateProcedure !!

CREATE Procedure UpdateProcedure
(
@firstname varchar(50),
@lastname varchar(50),
@address Varchar(100),
@city Varchar(50),
@state Varchar(50),
@pincode Varchar(20),
@EmailId Varchar(80),
@customerid int
)
AS
Update Registration set
customesr_firstname=@firstname,
customers_lastname= @lastname,
customers_address=@address,
customers_city= @city,
customers_state=@state,
customers_zipcode= @pincode ,
customers_email_address= @EmailId
where customers_id=@customerid


GO

UpdateProductProcedure !!

CREATE Procedure UpdateProductProcedure
(
@ProductName varchar(50),
@ProductPrice varchar(50),
@ProductDescription Varchar(100),
@Productid int

)
AS
update tblProduct_Master set

Product_Name=@ProductName,
Product_Price=@ProductPrice,
Product_desc=@ProductDescription
where Product_id=@Productid
GO

Insert Procedure !!

/*
Procedure Name :invoiceInsert
Description : This Procedure is Inserting the Invoice details
Created By: Chandrashekhar Dhingra
Creation Date :25/03/2008
*/

CREATE PROCEDURE invoiceInsert
(
@comdName varchar(50),
@vatD3 varchar(50),
@buyName varchar(50),
@bAddress varchar(500),
@bCity varchar(50),
@bState varchar(50),
@bPincode varchar(20),
@bCountry varchar(50),
@bEcc varchar(50),
@bTin varchar(50),
@conName varchar(50),
@cAddress varchar(500),
@cCity varchar(50),
@cState varchar(50),
@cPincode varchar(50),
@cCountry varchar(50),
@cEcc varchar(50),
@cTin varchar(50),
@ordNo varchar(50),
@ordDate datetime,
@confNo varchar(50),
@conDate datetime,
@rlNo varchar(50),
@rlDate datetime,
@destination varchar(50),
@transport varchar(50),
@transMode varchar(50),
@transTerms varchar(50),
@eCess float,
@tolPac varchar (50),
@she float,
@vat float,
@freight float,
@id int output
)
AS
insert into tblInvoiceDisplay
(
invoice_exComdName,
invoice_vatD3,
invoice_buyName,
invoice_bAddress,
invoice_bCity,
invoice_bState,
invoice_bPincode,
invoice_bCountry,
invoice_bEcc,
invoice_bTin,
invoice_conName,
invoice_cAddress,
invoice_cCity,
invoice_cState,
invoice_cPincode,
invoice_cCountry,
invoice_cEcc,
invoice_cTin,
invoice_ordNo,
invoice_ordDate,
invoice_confNo,
invoice_conDate,
invoice_rlNo,
invoice_rlDate,
invoice_dest,
invoice_transport,
invoice_transMode,
invoice_transTerms,
invoice_eCess,
invoice_tolpacl,
invoice_she,
invoiceAddVar,
invoice_freight
)
Values
(

@comdName,
@vatD3,
@buyName,
@bAddress,
@bCity,
@bState,
@bPincode,
@bCountry,
@bEcc,
@bTin,
@conName,
@cAddress,
@cCity,
@cState,
@cPincode,
@cCountry,
@cEcc,
@cTin,
@ordNo,
@ordDate,
@confNo,
@conDate,
@rlNo,
@rlDate,
@destination,
@transport,
@transMode,
@transTerms,
@eCess,
@tolPac,
@she,
@vat,
@freight
)
Select @id=Max(invoice_id) from tblInvoiceDisplay
GO

Insert Procedure !!

/*
Procedure Name :customerInsert
Description : This Procedure is Inserting the Customer details
Created By: Chandrashekhar Dhingra
Creation Date :24/03/2008
*/

CREATE PROCEDURE customerInsert
(
@custName varchar(100),
@custAdd varchar(500),
@custCity varchar(100),
@custState varchar(100),
@custPin varchar(20),
@custCountry varchar(100),
@custEcc varchar(50),
@custTin varchar(50),
@custID varchar(50),
@regDate datetime,
@active varchar(3),
@delete varchar(3)
)
AS
insert into tblCustomerMaster
(

cust_name,
cust_address,
cust_city,
cust_state,
cust_pin,
cust_country,
cust_eccNo,
cust_tinNo,
custom_id,
cust_regDate,
cust_active,
cust_delete
)
values
(
@custName,
@custAdd,
@custCity,
@custState,
@custPin,
@custCountry,
@custEcc,
@custTin,
@custID,
getdate(),
'Yes',
'No'
)
GO