public void Save() { if (customertype == null) { return; } ISession session = null; try { session = NHibernateHelper.GetCurrentSession(); ITransaction transaction = session.BeginTransaction(); if (string.IsNullOrEmpty(customertype.CustomerTypeID)) { customertype.CustomerTypeID = GetKey(session); } if (string.IsNullOrEmpty(customertype.CustomerTypeID)) { customertype.CustomerTypeID = GetKey(session); } session.SaveOrUpdate(customertype); transaction.Commit(); } catch (Exception ex) { throw ex; } finally { if (session != null) { NHibernateHelper.CloseSession(); } } }
public static List <Customers_> GetList(string Name) { ISession session = null; List <Customers_> objectsList = null; try { session = NHibernateHelper.GetCurrentSession(); objectsList = (List <Customers_>)session.CreateCriteria(typeof(Customers_)).List <Customers_>(); } catch (Exception ex) { throw ex; } finally { if (session != null) { NHibernateHelper.CloseSession(); } } return(objectsList); }
public void Save() { if (subheadcategoryfive == null) { return; } ISession session = null; try { session = NHibernateHelper.GetCurrentSession(); ITransaction transaction = session.BeginTransaction(); if (string.IsNullOrEmpty(subheadcategoryfive.subheadcategoryfiveID)) { subheadcategoryfive.subheadcategoryfiveID = GetKey(session); } //if (string.IsNullOrEmpty(subheadcategoryfive.subheadcategoryfiveID)) //{ subheadcategoryfive.subheadcategoryfiveID = GetKey(session); } session.SaveOrUpdate(subheadcategoryfive); transaction.Commit(); } catch (Exception ex) { throw ex; } finally { if (session != null) { NHibernateHelper.CloseSession(); } } }
public static DataTable GetCustomerList() { ISession session = null; IList objectsList = null; DataTable dT_ = new DataTable(); DataRow dR_ = null; try { // string queryString = " select a.customerid, a.CustomerName, a.GST,c.CategoryID, c.category, a.ntn, b.CustomerTypeID, b.customertype_, a.area, " + // " a.refnum, a.district, a.phoneno, a.email, a.cellno1, a.postalcode, a.CellNo2, a.PostalOfficeContact, a.CellNo3, " + // " a.NIC, a.CellNo4, d.CityID, d.city_, a.Address from Customers_ a inner join customertype b on " + //" a.customertypeid = b.customertypeid inner join CustomerCategory c on a.categoryid = c.categoryid inner join City d on a.cityid = d.cityid "; string queryString = " select a.customerid, a.CustomerName, a.GST,c.CategoryID, c.category, a.ntn, b.CustomerTypeID, b.customertype_, a.area, " + " a.refnum, a.district, a.phoneno, a.email, a.cellno1, a.postalcode, a.CellNo2, a.PostalOfficeContact, a.CellNo3, " + " a.NIC, a.CellNo4, d.CityID, d.city_, a.Address from Customers_ a inner join customertype b on " + " a.customertype_ = b.customertype_ inner join CustomerCategory c on a.category = c.category inner join City d on a.city_ = d.city_ "; session = NHibernateHelper.GetCurrentSession(); IQuery iQuery = session.CreateSQLQuery(queryString); objectsList = iQuery.List(); { dT_.Columns.Add("CustomerID"); dT_.Columns.Add("CustomerName"); dT_.Columns.Add("GST"); dT_.Columns.Add("CategoryID"); dT_.Columns.Add("category"); dT_.Columns.Add("NTN"); dT_.Columns.Add("CustomerTypeID"); dT_.Columns.Add("customertype_"); dT_.Columns.Add("Area"); dT_.Columns.Add("RefNum"); dT_.Columns.Add("District"); dT_.Columns.Add("PhoneNo"); dT_.Columns.Add("Email"); dT_.Columns.Add("CellNo1"); dT_.Columns.Add("PostalCode"); dT_.Columns.Add("CellNo2"); dT_.Columns.Add("PostalOfficeContact"); dT_.Columns.Add("CellNo3"); dT_.Columns.Add("NIC"); dT_.Columns.Add("CellNo4"); dT_.Columns.Add("CityID"); dT_.Columns.Add("city_"); dT_.Columns.Add("Address"); //dT_.Columns.Add("CreatedBy"); //dT_.Columns.Add("CreatedDate"); //dT_.Columns.Add("IsActive"); } foreach (object[] row_ in objectsList) { dR_ = dT_.NewRow(); dR_["CustomerID"] = row_[0]; dR_["CustomerName"] = row_[1]; dR_["GST"] = row_[2]; dR_["CategoryID"] = row_[3]; dR_["category"] = row_[4]; dR_["NTN"] = row_[5]; dR_["CustomerTypeID"] = row_[6]; dR_["customertype_"] = row_[7]; dR_["Area"] = row_[8]; dR_["RefNum"] = row_[9]; dR_["District"] = row_[10]; dR_["PhoneNo"] = row_[11]; dR_["Email"] = row_[12]; dR_["CellNo1"] = row_[13]; dR_["PostalCode"] = row_[14]; dR_["CellNo2"] = row_[15]; dR_["PostalOfficeContact"] = row_[16]; dR_["CellNo3"] = row_[17]; dR_["NIC"] = row_[18]; dR_["CellNo4"] = row_[19]; dR_["CityID"] = row_[20]; dR_["city_"] = row_[21]; dR_["Address"] = row_[22]; //dR_["CreatedBy"] = row_[19]; //dR_["CreatedDate"] = row_[20]; //dR_["IsActive"] = row_[21]; dT_.Rows.Add(row_); } } catch (Exception ex) { throw ex; } finally { if (session != null) { NHibernateHelper.CloseSession(); } } return(dT_); }
public static DataTable GetSupplierList() { ISession session = null; IList objectsList = null; DataTable dT_ = new DataTable(); DataRow dR_ = null; try { string queryString = " select a.supplierId, a.suppliername, a.contactperson, a.BackUpContact, a.City_, a.phoneno, a.mobile, a.faxno, a.postalcode, a.designation, " + " a.AddressOne, a.AddressTwo, a.CNIC, a.Url, a.BusinessNature, a.Email, a.NTNNTRNo, a.CreatedBy, convert(date, cast(a.CreatedDate as date) ,105) as [CreatedAt], a.IsActive, a.Sup_Code from supplier a order by a.supplierId desc"; session = NHibernateHelper.GetCurrentSession(); IQuery iQuery = session.CreateSQLQuery(queryString); objectsList = iQuery.List(); { dT_.Columns.Add("supplierId"); dT_.Columns.Add("suppliername"); dT_.Columns.Add("contactperson"); dT_.Columns.Add("BackUpContact"); dT_.Columns.Add("City_"); dT_.Columns.Add("phoneno"); dT_.Columns.Add("mobile"); dT_.Columns.Add("faxno"); dT_.Columns.Add("postalcode"); dT_.Columns.Add("designation"); dT_.Columns.Add("AddressOne"); dT_.Columns.Add("AddressTwo"); dT_.Columns.Add("CNIC"); dT_.Columns.Add("Url"); dT_.Columns.Add("BusinessNature"); dT_.Columns.Add("Email"); dT_.Columns.Add("NTNNTRNo"); dT_.Columns.Add("CreatedBy"); dT_.Columns.Add("CreatedDate"); dT_.Columns.Add("IsActive"); dT_.Columns.Add("Sup_Code"); } foreach (object[] row_ in objectsList) { dR_ = dT_.NewRow(); dR_["supplierId"] = row_[0]; dR_["suppliername"] = row_[1]; dR_["contactperson"] = row_[2]; dR_["BackUpContact"] = row_[3]; dR_["City_"] = row_[4]; dR_["phoneno"] = row_[5]; dR_["mobile"] = row_[6]; dR_["faxno"] = row_[7]; dR_["postalcode"] = row_[8]; dR_["designation"] = row_[9]; dR_["AddressOne"] = row_[10]; dR_["AddressTwo"] = row_[11]; dR_["CNIC"] = row_[12]; dR_["Url"] = row_[13]; dR_["BusinessNature"] = row_[14]; dR_["Email"] = row_[15]; dR_["NTNNTRNo"] = row_[16]; dR_["CreatedBy"] = row_[17]; dR_["CreatedDate"] = row_[18]; dR_["IsActive"] = row_[19]; dR_["Sup_Code"] = row_[20]; dT_.Rows.Add(row_); } } catch (Exception ex) { throw ex; } finally { if (session != null) { NHibernateHelper.CloseSession(); } } return(dT_); }
public static DataTable GetQuotationList() { ISession session = null; IList objectsList = null; DataTable dT_ = new DataTable(); DataRow dR_ = null; try { //string queryString = " select tbl_MProQuot.MProQuot_id,DProQuot_id,MProQuot_dat,MProQuot_rmk,tbl_MProQuot.CustomerID, " + // " CustomerName, tbl_DProQuot.ProductID, ProductName, MProQuot_app ,MProQuot_tamt," + // " MProQuot_Rej, tbl_MProQuot.CreatedBy, tbl_MProQuot.CreatedAt, tbl_MProQuot.ISActive " + // " from tbl_MProQuot " + // " inner join tbl_DProQuot on tbl_MProQuot.MProQuot_id = tbl_DProQuot.MProQuot_id and tbl_MProQuot.ISActive = tbl_DProQuot.ISActive " + // " inner join Products on tbl_DProQuot.ProductID = Products.ProductID " + // " inner join Customers_ on tbl_MProQuot.CustomerID = Customers_.CustomerID " + // " where MProQuot_app = 0 and MProQuot_Rej = 0 order by tbl_MProQuot.MProQuot_id desc "; string queryString = " select MProQuot_sono,MProQuot_dat,CustomerName,MProQuot_rmk, tbl_MProQuot.CreatedBy, tbl_MProQuot.CreatedAt,tbl_MProQuot.MProQuot_id,tbl_MProQuot.CustomerID, " + " MProQuot_app, MProQuot_Rej, tbl_MProQuot.ISActive " + " from tbl_MProQuot " + " inner join Customers_ on tbl_MProQuot.CustomerID = Customers_.CustomerID " + " where MProQuot_app = 0 and MProQuot_Rej = 0 and tbl_MProQuot.ISActive = 1 order by tbl_MProQuot.MProQuot_id desc"; session = NHibernateHelper.GetCurrentSession(); IQuery iQuery = session.CreateSQLQuery(queryString); objectsList = iQuery.List(); { dT_.Columns.Add("MProQuot_sono"); dT_.Columns.Add("MProQuot_dat"); dT_.Columns.Add("CustomerName"); dT_.Columns.Add("MProQuot_rmk"); dT_.Columns.Add("CreatedBy"); dT_.Columns.Add("CreatedAt"); dT_.Columns.Add("MProQuot_Rej"); dT_.Columns.Add("CustomerID"); dT_.Columns.Add("MProQuot_app"); dT_.Columns.Add("ISActive"); dT_.Columns.Add("MProQuot_id"); } foreach (object[] row_ in objectsList) { dR_ = dT_.NewRow(); dR_["MProQuot_sono"] = row_[0]; dR_["MProQuot_dat"] = row_[1]; dR_["CustomerName"] = row_[2]; dR_["MProQuot_rmk"] = row_[3]; dR_["CreatedBy"] = row_[4]; dR_["CreatedAt"] = row_[5]; dR_["MProQuot_Rej"] = row_[6]; dR_["CustomerID"] = row_[7]; dR_["MProQuot_app"] = row_[8]; dR_["ISActive"] = row_[9]; dR_["MProQuot_id"] = row_[10]; dT_.Rows.Add(row_); } } catch (Exception ex) { throw ex; } finally { if (session != null) { NHibernateHelper.CloseSession(); } } return(dT_); }
public static DataTable GetMPurList() { ISession session = null; IList objectsList = null; DataTable dT_ = new DataTable(); DataRow dR_ = null; try { //string queryString = " select MPurID, subheadcategoryfivename,VndrAdd,VndrCntct,PurNo,MPurDate,CNIC,NTNNo,MPurchase.CreatedBy,MPurchase.CreatedAt,ToBePrntd from MPurchase " + // " inner join subheadcategoryfive on MPurchase.ven_id = subheadcategoryfive.subheadcategoryfiveID "; string queryString = " select MPurID, suppliername,VndrAdd,VndrCntct,PurNo,MPurDate,supplier.CNIC,NTNNo, " + " MPurchase.CreatedBy,MPurchase.CreatedAt,ToBePrntd from MPurchase inner join " + " supplier on MPurchase.ven_id = supplier.supplierId "; session = NHibernateHelper.GetCurrentSession(); IQuery iQuery = session.CreateSQLQuery(queryString); objectsList = iQuery.List(); { dT_.Columns.Add("MPurID"); dT_.Columns.Add("suppliername"); dT_.Columns.Add("VndrAdd"); dT_.Columns.Add("VndrCntct"); dT_.Columns.Add("PurNo"); dT_.Columns.Add("MPurDate"); dT_.Columns.Add("CNIC"); dT_.Columns.Add("NTNNo"); dT_.Columns.Add("CreatedBy"); dT_.Columns.Add("CreatedAt"); dT_.Columns.Add("ToBePrntd"); } foreach (object[] row_ in objectsList) { dR_ = dT_.NewRow(); dR_["MPurID"] = row_[0]; dR_["suppliername"] = row_[1]; dR_["VndrAdd"] = row_[2]; dR_["VndrCntct"] = row_[3]; dR_["PurNo"] = row_[4]; dR_["MPurDate"] = row_[5]; dR_["CNIC"] = row_[6]; dR_["NTNNo"] = row_[7]; dR_["CreatedBy"] = row_[8]; dR_["CreatedAt"] = row_[9]; dR_["ToBePrntd"] = row_[9]; dT_.Rows.Add(row_); } } catch (Exception ex) { throw ex; } finally { if (session != null) { NHibernateHelper.CloseSession(); } } return(dT_); }