Пример #1
0
        public string SaveItem()
        {
            StringBuilder sbQry = new StringBuilder();
            clsDB         oDB   = new clsDB();

            try
            {
                oDB.Connect();
                string sMsg = "OK";
                sbQry.Append("Select Count(*) From Item Where ItemDesc = '" + ItemDesc + "'");
                int iCount = (int)oDB.ExecuteScalar(sbQry.ToString());
                sbQry.Length = 0;
                //If already exist then update otherwise insert
                if (iCount > 0)
                {
                    sMsg = "Item already exist!!";
                }
                else
                {
                    sbQry.Append("Insert Into Item(ItemDesc)  Values('" + ItemDesc + "')");
                }

                iCount = oDB.ExecuteNonQuery(sbQry.ToString());
                return(sMsg);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sbQry = null;
                oDB.DisConnect();
                oDB = null;
            }
        }
Пример #2
0
        public int SaveHeader()
        {
            StringBuilder sbQry = new StringBuilder();
            clsDB         oDB   = new clsDB();

            try
            {
                oDB.Connect();
                string sMsg = "OK";
                sbQry.Append("Select Count(*) From mHeader Where Id = '" + HeaderId + "'");
                int iCount = (int)oDB.ExecuteScalar(sbQry.ToString());
                sbQry.Length = 0;
                //If already exist then update otherwise insert
                if (iCount > 0)
                {
                    sbQry.Append("Update mHeader Set Header1='" + Header1 + "',Header2='" + Header2 + "',Header3='" + Header3 + "',Header4='" + Header4 + "'  Where Id = '" + HeaderId + "'");
                }
                else
                {
                    sbQry.Append("Insert Into mHeader(Id,Header1,Header2,Header3,Header4)  Values('" + HeaderId + "','" + Header1 + "','" + Header2 + "','" + Header3 + "','" + Header4 + "')");
                }

                iCount = oDB.ExecuteNonQuery(sbQry.ToString());
                return(iCount);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sbQry = null;
                oDB.DisConnect();
                oDB = null;
            }
        }
Пример #3
0
        public int SaveAddress()
        {
            StringBuilder sbQry = new StringBuilder();
            clsDB         oDB   = new clsDB();

            try
            {
                oDB.Connect();
                string sMsg = "OK";
                sbQry.Append("Select Count(*) From mAddress Where Id = '" + AddressId + "'");
                int iCount = (int)oDB.ExecuteScalar(sbQry.ToString());
                sbQry.Length = 0;
                //If already exist then update otherwise insert
                if (iCount > 0)
                {
                    sbQry.Append("Update mAddress Set Address1='" + Address1 + "',Address2='" + Address2 + "',Address3='" + Address3 + "',Address4='" + Address4 + "'  Where Id = '" + AddressId + "'");
                }
                else
                {
                    sbQry.Append("Insert Into mAddress(Id,Address1,Address2,Address3,Address4)  Values('" + AddressId + "','" + Address1 + "','" + Address2 + "','" + Address3 + "','" + Address4 + "')");
                }

                iCount = oDB.ExecuteNonQuery(sbQry.ToString());
                return(iCount);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sbQry = null;
                oDB.DisConnect();
                oDB = null;
            }
        }