예제 #1
0
        public bool DeleteTQuotation(TQuotation tquotation)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "DeleteTQuotation";

            cmd.Parameters.AddWithValue("@QuotationNo", tquotation.QuotationNo);
            commandcollection.Add(cmd);
            return(true);
        }
예제 #2
0
        public bool AddTQuotation(TQuotation tquotation)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddTQuotation";

            cmd.Parameters.AddWithValue("@QuotationNo", tquotation.QuotationNo);

            cmd.Parameters.AddWithValue("@QuotationUserNo", tquotation.QuotationUserNo);

            cmd.Parameters.AddWithValue("@QuotationDate", tquotation.QuotationDate);

            cmd.Parameters.AddWithValue("@FromDate", tquotation.FromDate);

            cmd.Parameters.AddWithValue("@ToDate", tquotation.ToDate);

            cmd.Parameters.AddWithValue("@LedgerNo", tquotation.LedgerNo);

            cmd.Parameters.AddWithValue("@CompanyNo", tquotation.CompanyNo);

            cmd.Parameters.AddWithValue("@UserID", tquotation.UserID);

            cmd.Parameters.AddWithValue("@UserDate", tquotation.UserDate);

            SqlParameter outParameter = new SqlParameter();

            outParameter.ParameterName = "@ReturnID";
            outParameter.Direction     = ParameterDirection.Output;
            outParameter.DbType        = DbType.Int32;
            cmd.Parameters.Add(outParameter);

            commandcollection.Add(cmd);
            return(true);
        }
예제 #3
0
        public TQuotation ModifyTQuotationByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from TQuotation where QuotationNo =" + ID;
            cmd            = new SqlCommand(sql, Con);
            cmd.Connection = Con;
            Con.Open();
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr;

            dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (dr.HasRows)
            {
                TQuotation MM = new TQuotation();
                while (dr.Read())
                {
                    MM.QuotationNo = Convert.ToInt32(dr["QuotationNo"]);
                    if (!Convert.IsDBNull(dr["QuotationUserNo"]))
                    {
                        MM.QuotationUserNo = Convert.ToInt64(dr["QuotationUserNo"]);
                    }
                    if (!Convert.IsDBNull(dr["QuotationDate"]))
                    {
                        MM.QuotationDate = Convert.ToDateTime(dr["QuotationDate"]);
                    }
                    if (!Convert.IsDBNull(dr["FromDate"]))
                    {
                        MM.FromDate = Convert.ToDateTime(dr["FromDate"]);
                    }
                    if (!Convert.IsDBNull(dr["ToDate"]))
                    {
                        MM.ToDate = Convert.ToDateTime(dr["ToDate"]);
                    }
                    if (!Convert.IsDBNull(dr["LedgerNo"]))
                    {
                        MM.LedgerNo = Convert.ToInt64(dr["LedgerNo"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    if (!Convert.IsDBNull(dr["StatusNo"]))
                    {
                        MM.StatusNo = Convert.ToInt64(dr["StatusNo"]);
                    }
                    if (!Convert.IsDBNull(dr["UserID"]))
                    {
                        MM.UserID = Convert.ToInt64(dr["UserID"]);
                    }
                    if (!Convert.IsDBNull(dr["UserDate"]))
                    {
                        MM.UserDate = Convert.ToDateTime(dr["UserDate"]);
                    }
                    if (!Convert.IsDBNull(dr["ModifiedBy"]))
                    {
                        MM.ModifiedBy = Convert.ToString(dr["ModifiedBy"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new TQuotation());
        }